个人工具

“UbuntuHelp:FilePermissions/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{Translation}}<br>{{From|http://wiki.ubuntu.org.cn/UbuntuHelp:FilePermissions}}<br>{{Translator|李威}}<br>{{Languages|UbuntuHelp:FilePermissions}}<br>)
 
第1行: 第1行:
 
{{Translation}}<br>{{From|http://wiki.ubuntu.org.cn/UbuntuHelp:FilePermissions}}<br>{{Translator|李威}}<br>{{Languages|UbuntuHelp:FilePermissions}}<br>
 
{{Translation}}<br>{{From|http://wiki.ubuntu.org.cn/UbuntuHelp:FilePermissions}}<br>{{Translator|李威}}<br>{{Languages|UbuntuHelp:FilePermissions}}<br>
 +
 +
=== Understanding and Using File Permissions ===
 +
 +
In Linux and Unix, everything is a file. Directories are files, files are files and devices are files. Devices are usually referred to as a node; however, they are still files. All of the files on a system have permissions that allow or prevent others from viewing, modifying or executing. If the file is of type Directory then it restricts different actions than files and device nodes. The super user "root" has the ability to access any file on the system. Each file has access restrictions with permissions, user restrictions with owner/group association. Permissions are referred to as bits. To change or edit files that are owned by root, '''sudo''' must be used - please see [[UbuntuHelp:RootSudo|RootSudo]] for details. If the owner read &amp; execute bit are on, then the permissions are:
 +
<pre>-r-x------
 +
</pre>
 +
There are three types of access restrictions:
 +
 +
{| cellspacing="0" border="1"
 +
|-
 +
| '''Permission'''
 +
| '''Action'''
 +
| '''chmod option'''
 +
|-
 +
| read
 +
| (view)
 +
| r or 4
 +
|-
 +
| write
 +
| (edit)
 +
| w or 2
 +
|-
 +
| execute
 +
| (execute)
 +
| x or 1
 +
|}
 +
 +
There are also three types of user restrictions:
 +
 +
{| cellspacing="0" border="1"
 +
|-
 +
| '''User'''
 +
| '''''ls'' output'''
 +
|-
 +
| owner
 +
| <code><nowiki>-rwx------</nowiki></code>
 +
|-
 +
| group
 +
| <code><nowiki>----rwx---</nowiki></code>
 +
|-
 +
| other
 +
| <code><nowiki>-------rwx</nowiki></code>
 +
|}
 +
 +
Directories have directory permissions. The directory permissions restrict different actions than with files or device nodes.
 +
 +
{| cellspacing="0" border="1"
 +
|-
 +
| '''Permission'''
 +
| '''Action'''
 +
| '''chmod option'''
 +
|-
 +
| read
 +
| (view contents, i.e. ls command)
 +
| r or 4
 +
|-
 +
| write
 +
| (create or remove files from dir)
 +
| w or 2
 +
|-
 +
| execute
 +
| (cd into directory)
 +
| x or 1
 +
|}
 +
 +
* read restricts or allows viewing the directories contents, i.e. ''ls'' command
 +
* write restricts or allows creating new files or deleting files in the directory. (Caution: '''write access for a directory allows deleting of files in the directory even if the user does not have write permissions for the file!''')
 +
* execute restricts or allows changing into the directory, i.e. ''cd'' command

2008年3月25日 (二) 15:40的版本





Understanding and Using File Permissions

In Linux and Unix, everything is a file. Directories are files, files are files and devices are files. Devices are usually referred to as a node; however, they are still files. All of the files on a system have permissions that allow or prevent others from viewing, modifying or executing. If the file is of type Directory then it restricts different actions than files and device nodes. The super user "root" has the ability to access any file on the system. Each file has access restrictions with permissions, user restrictions with owner/group association. Permissions are referred to as bits. To change or edit files that are owned by root, sudo must be used - please see RootSudo for details. If the owner read & execute bit are on, then the permissions are:

-r-x------

There are three types of access restrictions:

Permission Action chmod option
read (view) r or 4
write (edit) w or 2
execute (execute) x or 1

There are also three types of user restrictions:

User ls output
owner -rwx------
group ----rwx---
other -------rwx

Directories have directory permissions. The directory permissions restrict different actions than with files or device nodes.

Permission Action chmod option
read (view contents, i.e. ls command) r or 4
write (create or remove files from dir) w or 2
execute (cd into directory) x or 1
  • read restricts or allows viewing the directories contents, i.e. ls command
  • write restricts or allows creating new files or deleting files in the directory. (Caution: write access for a directory allows deleting of files in the directory even if the user does not have write permissions for the file!)
  • execute restricts or allows changing into the directory, i.e. cd command