Users, adding
Line 3: | Line 3: | ||
== Using [[pw]] to add a new user == | == Using [[pw]] to add a new user == | ||
− | + | ph34r#''' pw useradd username -g groupname -s /bin/csh -d /home/username''' | |
The command shown above will add a new user account named "username", assign the group "groupname" as the new user's primary group, set the [[C shell]] as its default [[shell]] on login, and set its home directory as "/home/username". It will '''not''' copy any .profile or similar files from /etc/skel, create any directories, or anything else - all [[pw]] does is manipulate the system user database for you. | The command shown above will add a new user account named "username", assign the group "groupname" as the new user's primary group, set the [[C shell]] as its default [[shell]] on login, and set its home directory as "/home/username". It will '''not''' copy any .profile or similar files from /etc/skel, create any directories, or anything else - all [[pw]] does is manipulate the system user database for you. | ||
Line 14: | Line 14: | ||
adduser can be run with no arguments, and will present you with a prompt for each question that needs to be answered in order to create the user that you're going to create | adduser can be run with no arguments, and will present you with a prompt for each question that needs to be answered in order to create the user that you're going to create | ||
− | dave@samizdata:~% su - | + | dave@samizdata:~% '''su -''' |
Password: | Password: | ||
− | samizdata# adduser felix | + | samizdata# '''adduser felix''' |
− | Username: felix | + | Username: '''felix''' |
− | Full name: Felix | + | Full name: '''Felix ''' |
Uid (Leave empty for default): | Uid (Leave empty for default): | ||
Login group [felix]: | Login group [felix]: | ||
− | Login group is felix. Invite felix into other groups? []: wheel | + | Login group is felix. Invite felix into other groups? []: '''wheel''' |
Login class [default]: | Login class [default]: | ||
− | Shell (sh csh tcsh tcsh bash) [sh]: bash | + | Shell (sh csh tcsh tcsh bash) [sh]: '''bash''' |
Home directory [/home/felix]: | Home directory [/home/felix]: | ||
Use password-based authentication? [yes]: | Use password-based authentication? [yes]: | ||
Line 31: | Line 31: | ||
Enter password again: | Enter password again: | ||
Lock out the account after creation? [no]: | Lock out the account after creation? [no]: | ||
− | Username : felix | + | Username : '''felix''' |
− | Password : ***** | + | Password : '''*****''' |
− | Full Name : Felix | + | Full Name : '''Felix ''' |
− | Uid : 1002 | + | Uid : '''1002''' |
Class : | Class : | ||
− | Groups : felix wheel | + | Groups : '''felix wheel''' |
− | Home : /home/felix | + | Home : '''/home/felix''' |
− | Shell : /usr/local/bin/bash | + | Shell : '''/usr/local/bin/bash''' |
− | Locked : no | + | Locked : '''no''' |
− | OK? (yes/no): yes | + | OK? (yes/no): '''yes''' |
adduser: INFO: Successfully added (felix) to the user database. | adduser: INFO: Successfully added (felix) to the user database. | ||
− | Add another user? (yes/no): n | + | Add another user? (yes/no): '''n''' |
Goodbye! | Goodbye! | ||
samizdata# | samizdata# |
Revision as of 15:49, 25 August 2004
There are several methods that are commonly used to add users to a FreeBSD system.
Using pw to add a new user
ph34r# pw useradd username -g groupname -s /bin/csh -d /home/username
The command shown above will add a new user account named "username", assign the group "groupname" as the new user's primary group, set the C shell as its default shell on login, and set its home directory as "/home/username". It will not copy any .profile or similar files from /etc/skel, create any directories, or anything else - all pw does is manipulate the system user database for you.
See also: Modifying users
Using adduser to add a new user
adduser can be run with no arguments, and will present you with a prompt for each question that needs to be answered in order to create the user that you're going to create
dave@samizdata:~% su - Password: samizdata# adduser felix Username: felix Full name: Felix Uid (Leave empty for default): Login group [felix]: Login group is felix. Invite felix into other groups? []: wheel Login class [default]: Shell (sh csh tcsh tcsh bash) [sh]: bash Home directory [/home/felix]: Use password-based authentication? [yes]: Use an empty password? (yes/no) [no]: Use a random password? (yes/no) [no]: Enter password: Enter password again: Lock out the account after creation? [no]: Username : felix Password : ***** Full Name : Felix Uid : 1002 Class : Groups : felix wheel Home : /home/felix Shell : /usr/local/bin/bash Locked : no OK? (yes/no): yes adduser: INFO: Successfully added (felix) to the user database. Add another user? (yes/no): n Goodbye! samizdata#
This will create the home directory of the new user, as well as manipulate the user database and groups database in order to add the user to the appropriate groups.