1_
useradd Example - Add a new user to secondary group
useradd -G {group-name} username
2_
See Which Groups Your Linux User Belongs To
groups peterd
3_
useradd -G admingroup Username
4_
%admingroup ALL=(ALL) ALL
If you do not see any output then you need to add group developers using the groupadd command:
Next, add a user called vivek to group developers:
Setup password for user vivek:
Ensure that user added properly to group developers:
useradd Example - Add a new user to secondary group
useradd -G {group-name} username
2_
See Which Groups Your Linux User Belongs To
groups peterd
3_
useradd -G admingroup Username
4_
%admingroup ALL=(ALL) ALL
If you do not see any output then you need to add group developers using the groupadd command:
# groupadd developersNext, add a user called vivek to group developers:
# useradd -G developers vivekSetup password for user vivek:
# passwd vivekEnsure that user added properly to group developers:
# id vivekusermod example - Add a existing user to existing group
Add existing user tony to ftp supplementary/secondary group with the usermod command using the -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option:
In this example, change tony user's primary group to www, enter:
# usermod -a -G ftp tonyIn this example, change tony user's primary group to www, enter:
# usermod -g www tonyadd user to sudoer
sudo adduser <username> sudo
create directory for user and group
'You will need to create the users directory manually. This requires three steps:- Create directory in compliance to
/etc/passwd, usually there will be already a /home/login entry. - Copy initial files from /etc/skel
- And finally set right permissions:
mkdir /home/YOUcd /home/YOUcp -r /etc/skel/. .chown -R YOU.YOURGROUP .chmod -R go=u,go-w .chmod go= .
Add user with home directory
useradd -m USERNAME
passwd USERNAME
沒有留言:
張貼留言