The "umask" command can be used to read or set default file permissions for the current user.
The umask value is subtracted from the default permissions (666) to give the final permission.root> umask 022
The "chmod" command is used to alter file permissions after the file has been created.666 : Default permission 022 : - umask value 644 : final permission
Character eqivalents can be used in the chmod command.root> chmod 777 *.log Owner Group World Permission ========= ========= ========= ====================== 7 (u+rwx) 7 (g+rwx) 7 (o+rwx) read + write + execute 6 (u+wx) 6 (g+wx) 6 (o+wx) write + execute 5 (u+Rx) 5 (g+Rx) 5 (o+Rx) read + execute 4 (u+r) 4 (g+r) 4 (o+r) read only 2 (u+w) 2 (g+w) 2 (o+w) write only 1 (u+x) 1 (g+x) 1 (o+x) execute only
The "chown" command is used to reset the ownership of files after creation.root> chmod o+rwx *.log root> chmod g+r *.log root> chmod -Rx *.log
The "-R" flag causes the command ro recurse through any subdirectories.root> chown -R oinstall.dba *
OS Users Management
See Linux Groups and Users.The "useradd" command is used to add OS users.
root> useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user
- The "-G" flag specifies the primary group.
- The "-g" flag specifies the secondary group.
- The "-d" flag specifies the default directory.
- The "-m" flag creates the default directory.
- The "-s" flag specifies the default shell.
The "userdel" command is used to delete existing users.root> usermod -s /bin/csh my_user
The "-r" flag removes the default directory.root> userdel -r my_user
The "passwd" command is used to set, or reset, the users login password.
The "who" command can be used to list all users who have OS connections.root> passwd my_user
root> who root> who | head -5 root> who | tail -5 root> who | grep -i ora root> who | wc -l
- The "head -5" command restricts the output to the first 5 lines of the who command.
- The "tail -5" command restricts the output to the last 5 lines of the who command.
- The "grep -i ora" command restricts the output to lines containing "ora".
- The "wc -l" command returns the number of lines from "who", and hence the number of connected users
No comments:
Post a Comment