七、user default configures
1.user default files
- copied from /etc/skel
2.user environment initialization files (用户初始文件夹)
[root@instructor ~]# ls -a /etc/skel
. .. .bash_logout .bash_profile .bashrc .gnome2 .mozilla
-~/.bash_profile:souring after user login
-~/.bashrc:souring after user enter into a new bash shell
-~/.bash_logout:executed after user logout
eg:
[root@instructor ~]# cat ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep='grep --color=auto'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
八、alias别名
[root@instructor ~]#alias l='ls -a'
但是重新登陆后,需要再次执行该命令。为了方便,可以直接将该命令
写入.bash_profile
九、sourcing files
1.changes to profile and bashrc files need to be sourced
2.two methods:(执行shell脚本的两种方式)
-.scriptname
-source scriptname
3.shell scripts can source other files
十、user management tools
1.GUI
-system-config-users
2.CLI
-useradd
-usermod
-userdel[-r]删除用户的时候一定要带-r参数,否则会暴露隐私
eg:修改用户的shell
[root@instructor ~]# usermod -s /sbin/nologin eric
[root@instructor ~]# su - eric
This account is currently not available.
[root@instructor ~]# usermod -s /bin/bash eric
[root@instructor ~]# su - eric
[eric@instructor ~]$
十一、password aging policies
1.by default,passwords do not expire
2.forcing passwords to expire is part of a strong security policy
3.modify default expiration settings in /etc/login.defs
4.to modify existing users.either:
-edit /etc/shadow by hand
-use chage [option] username
eg:vim /etc/login.defs
十二、default permissions
1.default permission for diretories is 777 minus umask
2.default permission fro files is the directory default without
execute permission
3.umask is set with the umask command
4.non-privileged users' umask is 002
- files will have permissions of 664
- directories will have permissions of 775
5.root's umask is 002
- files will have permissions of 644
- directories will have permissions of 755
eg:
user:(普通用户)
dir:777-umask(002)=775 (普通用户创建新目录时的权限)
rwxrwxr-x
file:777-umask(002)-xxx=664 (普通用户创建新文件时的权限)
rw-rw-r--
root
dir:777-umask(022)=755
rwxr-xr-x
file:777-umask(022)-xxx=644
rw-r--r--
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-06/102642.htm
