Linux文件有rwx即读、写、执行三种权限
管理文件权限
文件访问权限:rwxrwxrwx (777)
权限数值化后:(7)(7)(7)
r 读 -4 允许用户打开、浏览文件内容
w 写 -2 允许用户打开、编辑文件
x 执行 -1 允许用户执行
新创建文件默认权限为rw-r--r-- (644)
默认文件权限根据umask值设置(默认为022)
新文件权限为rw-r-r(644)
666 – 022 = rw-r--r--
新创建目录默认权限为rwxr-xr-x (755)
默认目录权限根据umask值设置(默认为022)
新目录权限为rwxr-xr-x
777 - 022 = rwxr-xr-x
umask
修改权限:chmod
添加、删除文件或目录状态
chmod u+x
chmod u=rwx,g=rw,o=r chmod 764
chmod o-r hello.txt
chmod a+x test 给所有用户other赋予执行权限(生产服务器不推荐给所有用户都赋予执行权限)
chmod u+x test 给当前用户other赋予执行权限
chmod g+x test 给同组用户other赋予执行权限
chmod o+x test 给其他用户other赋予执行权限
chmod +x test 默认是给所有用户赋予执行权限
chmod -x test 默认是给所有用户取消执行权限
去掉相应权限用-,例如:
chmod a-x test 给所有用户other去除执行权限
指定权限用=,例如:
chmod u=rwx test 指定当前用户拥有读写执行权限
实例:
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
[root@RHEL7x64 ~]# touch test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod u+x test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr--r--. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod o+x test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr--r-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod g+x test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod a-x test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod a+x test
[root@RHEL7x64 ~]# ll
总用量 4
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]#
[root@RHEL7x64 ~]# ll
总用量 8
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rw-r--r--. 1 root root 1915 7月 2 16:07 memtop.sh
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod +x memtop.sh
[root@RHEL7x64 ~]# ll
总用量 8
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr-xr-x. 1 root root 1915 7月 2 16:07 memtop.sh
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod -x memtop.sh
[root@RHEL7x64 ~]# ll
总用量 8
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rw-r--r--. 1 root root 1915 7月 2 16:07 memtop.sh
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]# chmod u+x memtop.sh
[root@RHEL7x64 ~]# ll
总用量 8
-rw-------. 1 root root 1209 6月 24 16:15 anaconda-ks.cfg
-rwxr--r--. 1 root root 1915 7月 2 16:07 memtop.sh
-rwxr-xr-x. 1 root root 0 6月 27 17:44 test
[root@RHEL7x64 ~]#
- 浏览: 163164 次
- 性别:
- 来自: 天津
文章分类
- 全部博客 (219)
- 数据库 (6)
- 开发环境搭建 (6)
- ireport (1)
- js (37)
- java操作office,xml等工具方法 (9)
- 正则表达式 (1)
- linux (19)
- jsp (6)
- 小功能 (12)
- 框架知识 (5)
- 杂项 (2)
- java开发知识 (26)
- 异常处理 (17)
- powerdesigner (2)
- 统计图fusionChart (2)
- css (2)
- sql mysql oracle语句实现 (2)
- 版本管理工具 (3)
- openstack (9)
- 开发习惯 (1)
- WeX5app开发 (16)
- Phython (4)
- qemu-kvm (9)
- tomcat (0)
- powershell (12)
- microsoft (12)
- asp (1)
- 网络知识 (1)
- 云计算 (1)
- 系统优化 (1)
- json (1)
- 微信开发 (1)
- react (1)
最新评论
发表评论
-
keepalived配置及典型应用案例
2016-11-17 10:41 427keepalived配置及典型应用案例 使用源码先安 ... -
yum update时候出现Another app is currently holding the yum lock解决方法
2016-11-14 18:15 439[root@localhost wangcheng]# yum ... -
Docker学习总结之Run命令介绍
2016-11-14 14:22 484在使用Docker时,执行最多的命令某过于run了。这个命令 ... -
vi指令一览
2016-01-21 11:01 328vi是所有UNIX系统都会提 ... -
每天一个linux命令
2016-01-21 10:24 502http://www.cnblogs.com/peida/ar ... -
vi编辑器总结
2016-01-13 09:15 0进入编辑模式 :a 或i (底部出现insert) ... -
mount.nfs: requested NFS version or transport protocol is not supported
2016-01-12 14:35 3340此错误发生的一种解决办法:更新文件 /etc/exports ... -
shell脚本教程
2016-01-08 09:00 348http://www.shellcn.net/shell/fi ... -
Linux vi替换字符串
2016-01-06 14:20 3131. 基本的替换 :s/vivian/sky/ 替换当前行第一 ... -
linux安装mysql绿色版问题记录
2015-12-30 14:07 01. 2.Starting MySQL. ER ... -
linux下导入导出mysql数据库
2015-12-29 14:22 426linux下导入、导出mysql数据库命令 资料 ... -
rhel配置安装环境变量,tomcat,及mysql
2015-12-29 11:25 0MYSQL_ROOT_PASSWORD=123456 ... -
Linux Top 命令解析
2015-10-29 09:22 451TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状 ... -
linux lsof详解
2015-10-28 11:06 338lsof简介 lsof(list open files ... -
ubuntu改变用户为root
2015-10-27 20:34 326sudo passwd root设置新密码。然后切换 -
http://man.chinaunix.net/
2015-10-26 17:35 632http://man.chinaunix.net/ -
virsh命令列表
2015-10-23 10:17 765命令: help 打印帮助 ... -
linux下文件的复制、移动与删除命令为:cp,mv,rm
2015-10-23 10:10 440linux下文件的复制、移 ... -
linux下vi命令大全
2015-10-13 17:04 334进入vi的命令 vi filename :打开或新建文件,并将 ... -
linux nano的使用(比vi方便)
2015-10-09 17:12 456如果你要保存所做的修改,按下Ctrl+O 。想要退出,按下C ...
相关推荐
linux chmod 操作系统 授权linux chmod 操作系统 授权linux chmod 操作系统 授权linux chmod 操作系统 授权linux chmod 操作系统 授权linux chmod 操作系统 授权
Linux+chmod+命令+详解.doc
linux的chmod命令使用详解借鉴.pdf
linux的chmod命令使用详解[归纳].pdf
根目录777 不在怕 一个命令解决 这是CentOS 7.4版本的纯净系统目录权限文件导入出问题的机器即可 setfacl --restore=/root/linux.chmod.bak
Linux chmod命令 Linux/Unix 的文件调用权限分为三级 : 文件拥有者、群组、其他。利用 chmod 可以藉以控制文件如何被他人所调用。 使用权限 : 所有使用者 语法 chmod [-cfvR] [--help] [--version] mode file... ...
linux-chmod命令参数及使用方法详解
在本篇文章里小编给大家分享了关于linux中chmod命令用法和相关知识点,需要的朋友们跟着学习下。
chmod命令使用详解chmod命令使用详解chmod命令使用详解
chmod给文件设置权限,tar是linux中常用的压缩命令,里面写个多个压缩格式
Linux-chmod_命令的详细用法讲解_.pdf
linuxchmod命令参数及用法详解--文件文件夹权限设定命令借鉴.pdf
Linx chmod 命令使用详解 教你如何使用chmod 命令 下载后评价可以免积分哦,还加一个积分,试过的……所以分数要的比较高哦~
linux下的chmod,chown和chgrp.pdf
Linux chmod指令