Linux四个常用的指挥机关处理具体的解释
原版的Blog。转载请注明出处
http://blog.csdn.net/hello_hwc?viewmode=contents
权限
对于文件
r 可读
w 可写
x 可运行
对于文件夹
r 能够列出文件夹的内容(ls)
w 能够在文件夹中创建和删除文件(touch/rm)
x 能够进入文件夹(cd)
一、chmod
chmod用来改变权限
经常使用的方式
1、用ugo+rwx 或者ugo-rwx或者ugo=rwx改变权限
这里的ugo
u 用户
g 用户组
o 其它人
比方:ug+x 就是为用户和用户组添加可运行权限
举例:
[root@localhost testForCsdn]# ls -l testfile
-rw-r----- 1 root root 0 Nov 1 22:14 testfile
为其它人赋予读写权限
[root@localhost testForCsdn]# chmod o=rw testfile
[root@localhost testForCsdn]# ls -l testfile
-rw-r--rw- 1 root root 0 Nov 1 22:14 testfile
为其它人去掉写的权限
[root@localhost testForCsdn]# chmod o-w testfile
[root@localhost testForCsdn]# ls -l testfile
-rw-r--r-- 1 root root 0 Nov 1 22:40 testfile
为用户组加入写的权限
[root@localhost testForCsdn]# chmod g+w testfile
[root@localhost testForCsdn]# ls -l testfile
-rw-rw-r-- 1 root root 0 Nov 1 22:40 testfile
2、用数字的方式改变权限
r相应4
w相应2
x相应1
比方:5=4+1 那么5代表的就是可读和可运行权限
举例
创建一个空文件,而且查看权限,能够看到,当前权限是rw-r--r--
也就是说:
对说有着来说是rw- 可读可写不可运行
对所属组来说是r-- 仅仅可写
对其它人来说是r-- 仅仅可写
举例
创建一个脚本。而且赋予它全部者的可运行权限
[root@localhost testForCsdn]# touch test.script
[root@localhost testForCsdn]# ls -l test.script
-rw-r----- 1 root root 0 Nov 1 22:43 test.script
[root@localhost testForCsdn]# chmod 744 test.script
[root@localhost testForCsdn]# ls -l test.script
-rwxr--r-- 1 root root 0 Nov 1 22:43 test.script
二、chown
改变全部者
首先加入用户hwc
[root@localhost testForCsdn]# useradd hwc
[root@localhost testForCsdn]# chown hwc test.script
[root@localhost testForCsdn]# ls -l test.script
-rwxr--r-- 1 hwc root 0 Nov 1 22:43 test.script
三、chgrp
改变所属组
首先加入用户组hwcgroup
[root@localhost testForCsdn]# chgrp hwcgroup test.script
[root@localhost testForCsdn]# ls -l test.script
-rwxr--r-- 1 hwc hwcgroup 0 Nov 1 22:43 test.script
四、umask
文件和文件夹创建的默认权限
查看默认权限
[root@localhost ~]# umask
0022
解释下,这里的第一个0是特殊权限位。一般不作考虑
022是用户权限位,这里的是掩码值
对于文件
即实际的权限应该是完整的权限777-022-111 = 644
就是rw-r--r--
改变缺省的权限值
[root@localhost ~]# umask 027
[root@localhost ~]# umask
0027
版权声明:本文博主原创文章,如需转载请注明出处
Linux四个常用的指挥机关处理具体的解释的更多相关文章
- linux系统监控常用工具
linux系统监控常用工具 一.系统核心工具包(coreutils) 1./bin/df 报告系统的磁盘空间用量 df -h 显示磁盘分区fdisk -l 2./bin/uname 显示系统信息 u ...
- linux:终端常用命令 + vi命令修改文件及保存 方法
首先介绍一下Ubuntu下各个目录的一般作用: / 这就是根目录,一台电脑有且只有一个根目录,所有的文件都是从这里开始的.举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录 ...
- Linux运维常用的几个命令介绍【转】
Linux运维常用的几个命令介绍 1. 查看系统内核版本 [root@funsion geekxa]# cat /etc/issue CentOS release 6.5 (Final) Kerne ...
- Linux平台上常用到的c语言开发程序
Linux操作系统上大部分应用程序都是基于C语言开发的.小编将简单介绍Linux平台上常用的C语言开发程序. 一.C程序的结构1.函数 必须有一个且只能有一个主函数main(),主函数的名为main. ...
- Linux运维-常用操作-培训用例
一.服务器环境 Centos 7.9 二.常用连接工具(免费) 1.Finalshell 2.MobaXterm 3.Putty + WinSCP 三.Linux 系统目录结构 /bin :是 Bi ...
- Linux Shell数组常用操作详解
Linux Shell数组常用操作详解 1数组定义: declare -a 数组名 数组名=(元素1 元素2 元素3 ) declare -a array array=( ) 数组用小括号括起,数组元 ...
- linux系统的常用命令
linux系统中常用的命令如下(以后经常补充): cd .. 返回上一级 cd use 进入use目录
- Linux入门学习 常用命令
cd命令 功能是切换到指定的目录:命令格式:cd [目录名]有几个符号作为目录名有特殊的含义:"/"代表根目录.".."代表上一级目录."~" ...
- struts2 Result Type四个常用转跳类型
Result的四个常用转跳类型分别为 Dispatcher 用来转向页面,是Struts的默认形式 Redirect 重定向到一个URL Chain 用来处理Action链 RedirectAc ...
随机推荐
- 汉字转换成对应ASCII
private static byte[] hanziToHexByte(string hanzistring) { byte[] bytes = Encoding ...
- sql for xml query sample
sample 1: declare @x xml select @x='<ArrayOfScheduledTime> <ScheduledTime> <Recurrenc ...
- Eclipse "Could not create java virtual machine"的问题解决
今天到了新的环境,需要重新搭建Android的开发环境,下载eclipse并安装了JDK1.6后,启动eclipse,发现出现了错误“Could not create Javavirtual mach ...
- C# 获取文件路径,读取项目中某程序集下文件
获取文件路径 ------------------------------------------------------------------------- winform获取文件路径: stri ...
- [Angular] Angular Global Keyboard Handling With EventManager
If we want to add global event handler, we can use 'EventManager' from '@angular/platform-broswer'. ...
- 开源分享三(炫酷的Android Loading动画)
开源分享三(炫酷的Android Loading动画) 分享GitHub上的一些Loading,为了提升产品用户体验,一个好的Loading必然是不可缺少的,对于一些耗时需要用户等待的页面来说会转移用 ...
- linux下FAT32格式u盘只读的问题及解决方法
以下是网上看到的解决办法:http://blog.csdn.net/heqiuya/article/details/7870554 其实是掉电保护,之前挂在的SD变成了制度文件,只需要将SD卡重新挂载 ...
- Spring常用工具类(ApplicationContextAware、DisposableBean、InitializingBean)
原创作品,出自 "晓风残月xj" 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/xiaofengcanyuexj). 由于各种原因,可能存在诸多不 ...
- [Elm] Installing and setting up Elm
Before writing any Elm we need to first install the runtime locally. In this lesson we install the E ...
- 栈溢出笔记1.9 认识SEH
从本节開始,我们就要研究一些略微高级点的话题了,如同在1.2节中看到的,Windows中为抵抗栈溢出做了非常多保护性的检查工作,编译的程序默认开启了这些保护. 假设我们不能绕过这些保护.那么我们的Sh ...