Wednesday, June 25, 2008

Solaris User account Management

User Administration
Below 3 files are important for creating new user account
/etc/passwd -contains user information.
/etc/shadow - information about password
/etc/group -information about group

# cat /etc/passwd
root:x:0:1:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
Username: Passwd: UID: GID: common name: home dir: Shell
-----------------------------------
/etc/shadow - info about password

# cat /etc/shadow
root:Sb3AZsvho.Flg:13600::::::
daemon:NP:6445::::::
sri:*LK*:::::::
rengs:yE3ME0wy9rSUI:13600::::::
Name:Passwd:Days from unix:min passwd age:Max passwd age:warn:inactive:expire:future purpose
-----------------------------------
/etc/group -info about group
bash-2.05# cat /etc/group
root::0:root
other::1:
sys::3:root,bin,sys,adm
name:grouppasswd:GID:secondary member list
-------------------------------------
UID informations
OS support max 2^31 users
0-99 reserved for system user
100-60000

1.Create new user account using useradd command
# useradd -u 606 -c rengarajang -md /export/rengs -s /bin/bash rengs
-u UID -c comment -md Home Dir -s Shell username

-u uid – Sets the unique UID for the new user.
-g group – Specifies a predefined group's ID or name.
-G group – Defines the new user's secondary group memberships.
-d dir – Defines the full pathname for the user’s home directory.
-m – Creates the new home directory if it does not already exist.
-s shell – Defines the full pathname for the shell program to be used as the user's login shell. If not defined, it defaults to /bin/sh.
–c comment – Typically used to specify the user’s full name and location.
-o – Allows a UID to be duplicated.
-e expire – Sets an expiration date on the user account. Specifies the date (mm/dd/yy) on which a user can no longer log in and access the account. The account is locked.
-f inactive – Sets the number of inactive days allowed on a user account. If the account is not logged into during the specified number of days it is locked.
-k skel_dir – Specifies an alternative directory location containing customized initialization files to be copied into the user’s home directory. (The default is /etc/skel.)

2.Creating alternate super account
# useradd -u 0 –o -c rengarajang -md / -s /bin/bash rengs

3.Modifying user properties using usermod
# usermod -u 606 -c Modifieduser rengs

4.Deleting user account
#userdel –r rengs

5.Managing groups we use following commands
Groupadd
Groupdel

6.Other files for user management
Below file should you modify to change the number of groups to which a user can belong
/etc/system
Default passwd policy in /etc/default/passwd
User profile files are stored in /etc/skel

No comments: