I'm trying to add a user into two groups when creating a new account. Now I use this command;
adduser --gid 33 --home /home/wwwroot/domain.com --force-badname %USER%and then
usermod -a -G group user (let say GID is 1008)I do this for each new user on a webserver to use SFTP (GID 1008).
What i want to do is this:
adduser + group + group
adduser --gid 33,1008 --home /home/wwwroot/domain.com --force-badname %USER%Unfortunately this doesn't work this way.
Any suggestions?
1 Answer
You can do it with: usermod, like this:
usermod -a -G group1,group2 usernameWhere username is the user you want to modify and group1 and group2 are the new groups you want that user to join. Running the command without the -a argument will remove that user from all groups except group1 and group2.
2