Fork me on GitHub

权限管理[Linux]

chown username file,... 改变文件的属主(只有管理员可以使用此命令)
-R:修改目录及其内部文件的属主
-reference=somefile_path file,...把想要设置属主的文件设置成和指定路径文件一样的
chown username:groupname file,...
chown username.groupname file...同时修改属主,属组
-R
-reference=somefile_path file,...
chgrp grpname file,...修改属组
-R
-reference=somefile_path file,...
chmod: 修改文件的权限
修改三类用户的权限(u,g,o, a)
chmod mode file...
-R
-reference=somefile_path file,...
修改某类用户权限
chmod 用户类别=mode file,....
修改某类用户的某些位权限
chmod 用户类别+|-mode file,...( chmod u+w /tmp/helloworld/)

手动添加用户(添加到三个文件)
[root@iZ28ec8xq8vZ openstack]# nano /etc/group
[root@iZ28ec8xq8vZ openstack]# nano /etc/passwd
[root@iZ28ec8xq8vZ openstack]# nano /etc/shadow
[root@iZ28ec8xq8vZ openstack]# openssl passwd -1 -salt '123456'

umask:遮罩号
文件 666-umask
目录 777-umask
文件默认不能具有执行权限,如果结果具有可执行权限则解决+1
umask027

用户登录Shell类型
登陆式shell:
正常通过某终端登陆的shell;
使用su -username/su -l username 登陆
非登陆式shell
su username;
图像终端下打开的命令窗口
自动执行的shell脚本

bash的配置文件

  1. 全局配置
    /etc/profile,/etc/propfile.d/*.sh,/etc/bashrc
  2. 个人配置
    /.bash_profile,/.bashrc
    profile类的文件:
    设定环境变量
    运行命令或者脚本
    bashrc类的文件
    设定本地变量
    定义命名别名

登陆式shll如何读取配置文件
/etc/profile--->/etc/profle.d/.sh-->/.bash_profile--->/.bashrc-->etc/bashrc
非登陆式shell如何配置文件
~/.bashrc -->etc/bashrc -->/etc/profile.d/
.sh
ls -l which passwd

posted @ 2016-06-11 20:26  Halower  阅读(405)  评论(0编辑  收藏  举报