2015年6月20日 星期六

visudo , add user

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:
# groupadd developers
Next, add a user called vivek to group developers:
# useradd -G developers vivek
Setup password for user vivek:
# passwd vivek
Ensure that user added properly to group developers:
# id vivek

usermod 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:
# usermod -a -G ftp tony
In this example, change tony user's primary group to www, enter:
# usermod -g www tony


add 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:
  1. Create directory in compliance to /etc/passwd, usually there will be already a /home/login entry.
  2. Copy initial files from /etc/skel
  3. And finally set right permissions:
    • mkdir /home/YOU
    • cd /home/YOU
    • cp -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

沒有留言:

張貼留言