---
title: "Linux知识十一：文件系统权限小结"
author: "berrywu"
date: "2010-11-12T16:21:24Z"
tags: []
categories: ["操作系统"]
slug: "linux"
draft: false
lastmod: "2010-11-12T16:21:24Z"
id: 809975
url: "https://berrywu.iteye.com/blog/809975"
---

权限知识：  
chown 用户:用户组 -R 目录：修改目录权限。  
chmod   +t 文件夹：文件仅能由他们的所有者或超级用户(root)删除。  
chmod +r 文件名：将档案file1.txt 设为所有人皆可读取。  
chmod ug+w,o-w file1.txt file2.txt：将档案file1.txt 与file2.txt 设为该档案拥有者，与其所属同一个群体者可写入﹐但其它以外的人则不可写入。  
chmod u+x ex1.py：将ex1.py 设定为只有该档案拥有者可以执行。  
chmod -R a+r \*：将目前目录下的所有档案与子目录皆设为任何人可读取。  
此外chmod也可以用数字来表示权限如chmod 777 file chmod abc file：其中a,b,c各为一个数字，分别表示User、Group、及Other的权限(r=4，w=2，x=1 若要rwx属性则4+2+1=7； 若要rw-属性则4+2=6； 若要r-x属性则4+1=7)。\[eg:chmod a=rwx file 和 chmod 777 file 效果相同 chmod ug=rwx,o=x file 和 chmod 771 file 66 效果相同]。