Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was trying to add a user called bill to www group

useradd -G www bill

It gives me error

UX: useradd: ERROR: bill is already in use.  Choose another.

I checked if this user already in the group www by typing this command

group bill

it resulted

bill:bill

Which means he is not in www group but still i keep getting the error

Later I realized from this link that there are different commands to add existing user to existing group and adding a new user to new group. So I tries this command to add bill (an existing user) to www (an existing group)

usermod -a -G www bill

It gives me syntax error

UX: usermod: ERROR: Invalid syntax.
usage:  usermod -u uid [-o] | -g group | -G group[[,group]...] |
                -d dir [-m] | -s shell | -c comment |
                -l new_logname | -f inactive | -e expire |
                -A authorization [, authorization ...] | -K key=value ... |
                -P profile [, profile ...] | -R role [, role ...] login

Please help

share|improve this question
add comment

1 Answer

You have two options: the usermod you wrote is correct, but the implementation you use does not handle -a. Just get rid of it and try again.

The second option is to use adduser from the adduser package. Then you will be able to write adduser username groupname.

share|improve this answer
    
"-bash: adduser: command not found" –  Windows Jan 4 '13 at 11:35
    
Maybe you don't have it installed: apt-get install adduser –  eppesuig Jan 4 '13 at 11:39
    
moreover, the usermod you typed seems correct to me. It fails becuase the ubuntu usermod seems to ignore option -a. Could you try without using it? –  eppesuig Jan 4 '13 at 11:41
    
surprisingly working :) which didnt worked yesterday. can you update the answer with this because your answer leading to other issues? –  Windows Jan 4 '13 at 11:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.