Thursday, January 5, 2012

user & group policy

Remember these------

Refault permission for directory & file

directory =777-022=755
file=666-022=644
x+suid=s or -+suid=S value=4
x+sgid=s or -+sgid=S value=2
x+stickybit=t or -+stickybit=T value=1
read=4 write=2 execute=1 total value=7


[root@localhost named]    umask 027 username
[root@localhost named]#    chmod o+rwx u+rwx g+rwx
[root@localhost named]    chown username dir/filename
[root@localhost named]    chown .groupname dir/filename
[root@localhost named]    chgrp groupname dir/filename
[root@localhost named]    chown username.groupname dir/filename

[root@localhost named]    usermod groupname,groupname,groupname username (to add a user to more additional/secondary group both)

[root@localhost named]    usermod -a -G groupname,groupname,groupname username ( to add a user that is already exist in a secondary group, to more additional/secondary group)

[root@localhost named]    groupmod -g 700 (ID) groupname ( to change group ID)

[root@localhost named]    gpasswd -M username,username,username groupname (to add one more users to a specific group both)

[root@localhost named]    finger username (to see a user information)
[root@localhost named]    usermod -s /sbin/nologin username (to detect a users shell)
[root@localhost named]    usermod -s /bin/bash username ( to add a users shell)
[root@localhost named]    usermod -l username (to lock a user)
[root@localhost named]    usermod -u username ( to unlock a user)
[root@localhost named]    usermod -G 0 username (to remove a user from his existing group)
[root@localhost named]    chage -l username (to see users change information)
[root@localhost named]    chage -e 2012-08-01 username ( to expire a user)
[root@localhost named]    chage -1 username ( to change to the previous mode)
[root@localhost named]    usermod -l newname oldname ( to change login name)
[root@localhost named]    mv /home/username (old path) /home/username ( new path) ( to change directory of a user)

[root@localhost named]    usermod -c userfullname oldname (to change users full name)