Saturday, April 12, 2008

FreeBSD 101 - Adding New User


adduser command


In system adminstration, one of the first thing that you need to know is how to create or add a new user. It is a good practice not to use the 'root' account especially when you access your system remotely. We need to create a new user account with basic privilages and just allow this user to switch to 'superuser' whenever it is needed.

To add a new user in freebsd you just execute the 'adduser' command at the prompt but make sure you are using your root account when doing this.


# adduser (press enter)
Username: obispo (type the username to be added and press enter)

Full name: ark obispo (type the full name of the user account or you just press enter)

Uid (Leave empty for default): (just press enter)

Login group [obispo]: (just press enter)

Login group is obispo. Invite obispo into other groups? []: wheel (if you allow this account to be able to switch to 'superuser', type wheel then press enter or else, just press enter)

Login class [default]: (just press enter)

Shell (sh csh tcsh nologin) [sh]: (choose the shell you want to use or just press enter)

Home directory [/home/obispo]: (just press enter)

Use password-based authentication? [yes]: (just press enter)

Use an empty password? (yes/no) [no]: (just press enter)

Use a random password? (yes/no) [no]: (just press enter)

Enter password: (type in the password for obispo then press enter)

Enter password again: (retype the password for obispo the press enter)

Lock out the account after creation? [no]: (just press enter)

Username : obispo
Password : **************
Full Name : ark obispo
Uid : 1007
Class :
Groups : obispo wheel
Home : /home/obispo
Shell : /bin/sh
Locked : no
OK? (yes/no): yes (type 'yes' then press enter)

adduser: INFO: Successfully added (obispo) to the user database.
Add another user? (yes/no): no (type 'yes' if you want to add another user, otherwise, type 'no' then then press enter)

Goodbye!

#


Adding a new user to a group


If it so happen that you already have added a new user into your system and you want this user to be able to switched to 'superuser' mode, edit the file /etc/group using favorite unix text editor and append the username at the wheel group like the one shown below:


wheel:*:0:root,obispo


To switch from your newly created account to superuser, just type the command 'su' and supply your superuser(or root) password.



No comments: