Thursday, December 16, 2010

User and Group Administration in Solaris

Configuration Files (and their contents) :

/etc/passwd :
UserName:x:UID:GID:comment:home_directory:login_shell

/etc/shadow :
UserName:password:lastchg:min:max:warn:inactive:expire:

/etc/group :
GroupName:group-password:GID:Username-list

/etc/default/password :

MAXWEEKS=
MINWEEKS=
PASSLENGTH=6
#MINDIFF=3
#MINALPHA=2
#MINNONALPHA=1
#MINUPPER=0
#MINLOWER=0
#MAXREPEATS=0
#MINSPECIAL=0
#MINDIGIT=0
#WHITESPACE=YES

/etc/security/policy.conf :
#LOCK_AFTER_RETRIES=NO

System-Wide Initialization Files:
Korn Shell     : /etc/profile
Bourne Shell  : /etc/profile
Bash Shell      : /etc/profile
C Shell          : /etc/.login

User Initialization Files:
Korn Shell     : $HOME/.profile, $HOME/.kshrc
Bourne Shell  : $HOME/.profile
Bash Shell      : $HOME/.profile
C Shell           : $HOME/.cshrc, $HOME/.login

Skeleton(Template) files for User Intialization Files :
Korn Shell     : /etc/skel/local.profile
Bourne Shell  : /etc/skel/local.profile
Bash Shell      : /etc/skel/local.profile
C Shell           : /etc/skel/local.cshrc and /etc/skel/local.login


Commands :

1. To add a user : (user any of the below commands)
# useradd -u 102 -g dba -d /export/home/jack -m -s /bin/bash -c "Jack Smith" jack

# smuser add -- -n jack -u 102 -g dba -d /export/home/jack -s /bin/bash -c "Jack Smith" -x

2. To modify a user's shell:
# usermod -s /bin/ksh jack

3. To modify a user's login name:
# usermod -l jsmith jack
# smuser modify -- -n jack -N jsmith

4. To delete a user :
# userdel jsmith
# smuser delete -- -n jack

5. To delete a user along with his/her home directory:
# userdel -r jsmith

6. To create a group :
# groupadd -g 402 dba
# smgroup add -- -n dba -g 402  -m jack

7. To modify a group's property :
# groupmod -g 410 dba
# smgroup modify -- -n dba -g 410

8. To delete a group :
# groupdel dba
# smgroup delete -- -n dba

9. To list all the users :
# listusers

10. To list the currently logged in users :
# who

11. To list last login report :
# last

12. To list all the users logged in the local and remote hosts :
# rusers -l

13. To display user information :
# finger jack

14. To record failed logins :
# touch /var/adm/loginlog
# chown root.sys /var/adm/loginlog
# chmod 600 /var/adm/loginlog


15. To prohibit a user from using ftp.

Add him in /etc/ftpd/ftpusers file.

16. To enable password-less login from remote servers :
Add the hsotname and username in the below format to /etc/hosts.equiv or $HOME/.rhosts file

hostname
hostname username
+

17. To list the groups the current user belongs to :
# groups

18. To list the groups an user belongs to :
# groups jack

19. To list the uid, gid of the current user :
# id

20. To display the uid and Primary gid of a user :
# id jack

21. To display the uid and Primary as well as secondary gids of a user :
# id -a jack

5 comments:

  1. nice one,keep continue like this

    ReplyDelete

  2. vrmani finds it is very boring topic

    ReplyDelete
  3. I know it is bit boring topic. But we cannot skip user administration whilst studying solaris.

    ReplyDelete
  4. This is Good...
    But, I think its /etc/default/passwd is used to tune the password complexities and not /etc/default/password as described above....

    ReplyDelete