Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

group_user_ensure fails in suse 11 sp3 #181

Open
rgcr opened this issue Apr 22, 2015 · 5 comments
Open

group_user_ensure fails in suse 11 sp3 #181

rgcr opened this issue Apr 22, 2015 · 5 comments

Comments

@rgcr
Copy link
Contributor

rgcr commented Apr 22, 2015

Hi Sebastian please check this

group_user_ensure(group='test', user='www')

I got this:

sudo: usermod -a -G 'test' 'www'
[mo9e] out: usermod: invalid option -- 'a'
[mo9e] out: Try `usermod --help' or `usermod --usage' for more information.
[mo9e] out:


Fatal error: sudo() received nonzero return code 2 while executing!

Requested: usermod -a -G 'test' 'www'
Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "usermod -a -G 'test' 'www'"

As per the man doesn't exist an option "-a"

Usage: usermod ...
usermod - modify a user account

  -c comment     Set the GECOS field for the new account
  -D binddn      Use dn "binddn" to bind to the LDAP directory
  -d homedir     Home directory for the new user
  -e expire      Date on which the new account will be disabled
  -f inactive    Days after a password expires until account is disabled
  -G group,...   List of supplementary groups
  -g gid         Name/number of the users primary group
  -l login       Change login name.
  -m             Move home directory to the new path
  -o             Allow duplicate (non-unique) UID
  -A group,...   List of groups the user should be added to
  -R group,...   List of groups the user should be removed from
  -P path        Search passwd, shadow and group file in "path"
  -p password    Encrypted password as returned by crypt(3)
  -s shell       Name of the user's login shell
  -u uid         Change the userid to the given number
  --service srv  Use nameservice 'srv'
  -L             Locks the password entry for "user"
  -U             Try to unlock the password entry for "user"
      --help     Give this help list
      --usage    Give a short usage message
  -v, --version  Print program version
Valid services are: files, ldap
@sebastien
Copy link
Owner

SUSE's usermod is not the same as the one on Debian/Ubuntu. The one shipped here is from shadow-utils 4.1.5.1. Could you paste me the output of cat /etc/lsb-release on your remote system?

@rgcr
Copy link
Contributor Author

rgcr commented Apr 23, 2015

There is the output:

~> cat /etc/*release*
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64"

@sebastien
Copy link
Owner

Not sure I want to add a specific case to handle that, I don't see a combination of options that would work for both usermod commands. Do you have shadowutils installed?

@rgcr
Copy link
Contributor Author

rgcr commented Oct 27, 2015

no, I have pwdutils

# rpm -qf /usr/sbin/usermod
pwdutils-3.2.15-0.13.1

@sebastien
Copy link
Owner

You're welcome to create a pull request for that, as I don't have the environment at hand to test it -- this could be defined as a variant (such as what we already do with the package_* functions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants