You need to use the following commands:
First, login as the root user
You must login as the root user. You can switch to the root user by typing 'su -' and entering the root password, when prompted. However, sudo command is recommend under Ubuntu Linux for switching to root user:su -
ORsudo -s
ORsudo useradd ...
Ubuntu Linux: add a new user to secondary group
Use the following syntax:
useradd -G Group-name Username
passwd Username
Create a group called test and add user tom to a secondary group called foo:$ sudo groupadd test
$ sudo useradd -G test tom
OR
# groupadd test
# useradd -G test tom
Verify new settings:
id tom groups tomFinally, set the password for tom user, enter:
$ sudo passwd tom
OR
# passwd tom
You can add user tom to multiple groups - test, bar, foo and ftp, enter:
# useradd -G test,foo ,bar,ftp tom
Ubuntu Linux: add a new user to primary group
To add a user called tom to a group called www use the following command:useradd -g www tom id tom groups tom
Ubuntu Linux: add a existing user to existing group
To add an existing user jerry to ftp supplementary/secondary group with usermod command using -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option:usermod -a -G ftp jerry id jerryTo change existing jerry's primary group to www, enter:
usermod -g www jerry
you can share it with others...
Comments
Post a Comment