Pages

Thursday, July 11, 2013

User Management in FreeBSD

These tools provide ability to manage the users across the system.
adduser is
# adduser 
Below are the steps involved when using adduser command in freeBSD.
Username: hemanth
Full name: Hemanth Murali
Uid (Leave empty for default):
Login group [hemanth]:
Login group is hemanth. Invite hemanth into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]: bash
Home directory [/home/hemanth]:
Home directory permissions (Leave empty for default):
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   : hemanth
Password   : *****
Full Name  : Hemanth Murali
Uid        : 1002
Class      :
Groups     : hemanth
Home       : /home/hemanth
Home Mode  :
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (hemanth) to the user database.
Add another user? (yes/no): yes
Username:


IN BSD adduser script updates password in two files
1. /etc/password
2. /etc/master.password 

adduser script automatically copies the /usr/share/skel directory dot files to users home directory.
REMOVING A LOCAL USER


[root@basd1 ~]# rmuser
Please enter one or more usernames: hemanth
Matching password entry:
hemanth:*:1002:1002::0:0:Hemanth Murali:/home/hemanth:/usr/local/bin/bash
this the entry you wish to remove? yes
Remove user's home directory (/home/hemanth)? yes
Removing user (hemanth): mailspool home passwd.

-y option with rmuser will remove with taking yes for all the questions
# rmuser -y hemnath 
To update the user attributes.
#chpass -s /bin/csh vasanth
The above command will change the uer shell to csh.
FreBSD imposes no account linits regarding: expiration and mandatory password change.
To change users password
# passwd username 
To list the attributes of a user
# pw show user vasanth
 Output:
vasanth:*:1001:1001::0:0:Vasanth Muraleedharan:/home/vasanth:/usr/local/bin/bash


To change the shell of the user using pw
# pw mod user vasanth -s /bin/sh

pw command changes the following files - /etc/passwd,/etc/master.passwd,group

Enjoy !!!

No comments:

Post a Comment