file permissions

  • 文件读写权限

[[email protected] /]# ll /tmp/

total 20

drwx-w-r--. 2 root root    6 May  3 12:24 a1

d-w-r----x. 2 root root    6 May  3 12:24 a2

#ll或#ls -l 命令可查看到文件和文件夹权限,主要针对三类对象:owner,group,other

总结了对应的读写标识、三位2进制、8进制

---
000 0

--x
001 1

-w-
010 2

-wx
011 3

r--
100 4

r-x
101 5

rw-
110 6

rwx
111 7

COMMAND:chmod [OPTION]... [MODE] FILE...

-R: 递归修改权限

MODE:

修改一类用户的所有权限:

u=

g=

o=

ug=

a=

u=,g=

修改一类用户某位或某些位权限

u+

u-

EXAMPLE:修改/tmp/a1文件为属主可写可读|属组只读|其他没有任何权限

修改前:

[[email protected] /]# ll /tmp/

total 20

drwx-w-r--. 2 root root    6 May  3 12:24 a1

修改后:

[[email protected] /]# chmod 640 /tmp/a1

[[email protected] /]# ll /tmp/

total 20

drw-r-----. 2 root root    6 May  3 12:24 a1

COMMAND:chmod [OPTION]... --reference=RFILE FILE...

参考RFILE文件的权限,将FILE的修改为同RFILE;

  • 修改文件的属主和属组:仅root用户可用

修改文件的属主:chown

COMMAND:chown [OPTION]... [OWNER][:[GROUP]] FILE...

用法:

OWNER

OWNER:GROUP

:GROUP

Note: 命令中的冒号可用.替换;

-R: 递归

COMMAND:chown [OPTION]... --reference=RFILE FILE...

修改文件的属组:chgrp

chgrp
[OPTION]... GROUP FILE...

chgrp
[OPTION]... --reference=RFILE FILE...

-R

EXAMPLE:修改/tmp/b文件属主为simon,属组为simon

修改前:

[[email protected] /]# ll /tmp/

total 20

d-w-r----x. 2 root root    6 May  3 12:24 a2

修改后:

[[email protected] /]# chown simon:simon /tmp/a2

[[email protected] /]# ll /tmp/

total 20

d-w-r----x. 2 simon simon    6 May  3 12:24 a2

    • 文件或目录创建时的遮罩码:umask

FILE: 666-umask

Note:
如果某类的用户的权限减得的结果中存在x权限,则将其权限+1

DIR:
777-umask

umask: 查看

[[email protected] /]# umask

0022

umask #: 设定

[[email protected] /]# umask 0033

[[email protected] /]# umask

0033

时间: 2024-12-06 11:48:54

file permissions的相关文章

Error of "Please Check for Sufficient Write File Permissions"

The error message “Please check for sufficient write file permissions” is generated by the Web-based downloader, known as Magento Connect Manager, which forms part of the Magento eCommerce platform. The Magento eCommerce platform is an open-source pl

Beginners Level Course:File Permissions - chmod

Linux继承了Unix的文件所属者和权限的概念.基本的原因是这样可以在网络系统中方便的使用,在网络系统中用户可以使用各种各样的程序.文件等等.很显然,这需要保持其组织性和安全性.我们不想一个普通用户使用一个潜在能使整个系统变成垃圾的程序.这里同样存在安全和隐私问题.用一个现实的例子说明:我们不想让Bill看Bob写给在R&D工作的Janet的情书.(因为Janet是Bill的未婚夫).最终,重要的是要知道什么是属于我的.你的和每个人的. 在本文刚开始提到的,很大的优势是Linux拥有多用户的概

Magento Connector: Error: Please check for sufficient write file permissions

请确保下面的文件是可写的: /path/to/your/magento-install/path/to/your/magento-install/downloader/path/to/your/magento-install/downloader/config.ini/path/to/your/magento-install/downloader/pearlib/config.ini/path/to/your/magento-install/downloader/pearlib/pear.ini

QTVA-2015-198545、WooYun-2015-104148 .NET Framework Arbitrary File Permissions Modify Vul

catalog 1. Description 2. Effected Scope 3. Exploit Analysis 4. Principle Of Vulnerability 5. Patch Fix 1. Description 通过.NET Framework的这个API漏洞,攻击者可以赋予任意程序文件执行权限 Relevant Link: http://www.wooyun.org/bugs/wooyun-2015-0104148 https://butian.360.cn/vul/

CentOS搭建apache,总是报错:(13)Permission denied: file permissions deny server access

查错误日志, 发现apache启动时有提示:[notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0 原来是SELinux的安全策略导致的. 临时方案:setenforce 0 永久方案:修改/etc/sysconfig/selinux:SELINUX=disabled 重启生效! 原文地址:https://www.cnblogs.com/blogzcan/p/829750

rancid install file

What is Rancid ? RANCID monitors a router's (or more generally a device's) configuration,including software and hardware (cards, serial numbers, etc) and uses CVS (Concurrent Version System) or Subversion to maintain history of changes. What RANCID D

Samba set of user authentication and file access rights

This series is compatible with Linux certification exam LPIC. A typical Linux user-level topics omitted, I am picked up the contents of the system management and server management. In addition, not only LPIC measures, we have questions problem asking

File System Design Case Studies

SRC=http://www.cs.rutgers.edu/~pxk/416/notes/13-fs-studies.html Paul Krzyzanowski April 24, 2014 Introduction We've studied various approaches to file system design. Now we'll look at some real file systems to explore the approaches that were taken i

java Permissions and Security Policy--官方文档

3 Permissions and Security Policy 3.1 The Permission Classes The permission classes represent access to system resources. The java.security.Permission class is an abstract class and is subclassed, as appropriate, to represent specific accesses. As an