手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux培训笔记之用户、组及权限

[日期:2014-06-03] 来源:Linux社区  作者:Linux [字体:大 中 小]

七、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

linux
相关资讯       Linux培训笔记 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款