Thursday, May 30, 2013

Users & Groups

Adding a User - Syntax & Example:
useradd -s <shell> -g <name-of-home-directory> -m -k <change input location to special null device instead of /etc/skel default> <username>
# useradd -s /bin/bash -g lfs -m -k /dev/null <username>

To be able to log in as the newly-created user:
# passwd <username>

 Adding a user during initial installation
# groupadd <groupname>
# useradd -m <username>
# groupadd wheel
# gpasswd -a [user] [group]
# gpasswd -a <username> wheel
# gpasswd -a <username> video
# gpasswd -a <username> audio
# gpasswd -a <username> lp
# passwd <username>

 Adding a new group
# groupadd <name-of-group>
# groupadd storage

 Adding an existing user to a new group
# groupadd storage
# usermod -a -G storage aco

 Delete users/groups
# userdel -r <username>
# groupdel <groupname>

No comments:

Post a Comment