`
tkiicpp
  • 浏览: 84325 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

liunx chmod command

阅读更多
 

Linux / Unix chmod command

Quick links

About chmod
Syntax
Examples
Additional information
Related commands
Linux / Unix main page

About chmod

Changes the permission of a file.

Syntax

chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...

-c, --changes like verbose but report only when a change is made
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-f, --silent, --quiet suppress most error messages
-v, verbose output a diagnostic for every file processed
--reference=RFILE use RFILE's mode instead of MODE values
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit

Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.

Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Examples

The above numeric permissions can be added to set a certain permission, for example, a common HTML file on a Unix server to be only viewed over the Internet would be:

chmod 644 file.htm

This gives the file read/write by the owner and only read by everyone else (-rw-r--r--).

Files such as scripts that need to be executed need more permissions. Below is another example of a common permission given to scripts.

chmod 755 file.cgi

This would be the following 400+040+004+200+100+010+001 = 755 where you are giving all the rights except the capability for anyone to write to the file.cgi file(-rwxr-xr-x).

Finally, another common CHMOD permission is 666, as shown below, which is read and write by everyone.

chmod 666 file.txt

Additional information

Below is an example of how a file may be listed when typing ( ls -l ) at the prompt as well as information on how to interpret it.

-rw-rw-r-- 1   hope  123   Feb 03 15:36   file.txt

- rw rw- r-- 1 hope 123 Feb 03 15:36 file.txt
File owner group everyone else links owner size mod date file name

分享到:
评论

相关推荐

    Linux.Command(PDF)

    本资源"Linux.Command(PDF)"是针对Linux操作系统中命令行工具的一个详细指南,旨在帮助用户深入理解和掌握在Linux环境下进行日常操作的各种命令。 Linux命令是与操作系统交互的主要方式,它允许用户执行各种任务,...

    Linux_command_tutorial

    ### Linux命令教程 ...以上就是`cat`、`cd`、`chmod`和`chown`四个Linux常用命令的详细介绍。这些命令在日常的Linux操作中非常实用,了解它们的基本用法和高级特性可以帮助用户更高效地管理文件和目录。

    The Linux Command Line(中文版).pdf.zip

    文件权限和所有权是Linux系统的关键概念,本教程会详细解释`chmod`(修改权限)、`chown`(更改所有者)和`chgrp`(更改组)命令的用法。同时,还会介绍打包和压缩工具,如`tar`和`gzip`,它们在数据备份和传输中...

    Linux命令搜索工具linux-command.zip

    linux-command Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。   Linux命令分类 这里存放Linux 命令大全并不全,你可以通过linux-command来搜索,它是把 command ...

    Linux命令_Linux-Command.zip

    压缩包文件“Linux命令_Linux-Command.zip”可能包含了一系列关于Linux命令的教学材料、实践指南或示例脚本,旨在帮助用户学习和掌握Linux环境下的命令行操作。文件名称“Linux-Command-master”可能暗示这是一个...

    ice_chen_linux_command

    本文将深入探讨“ice_chen_linux_command”这个主题,它聚焦于Linux命令行操作,帮助用户掌握日常工作中必备的命令技能。 首先,我们要理解Linux命令行界面(CLI)的重要性。在没有图形化界面的远程服务器或为了...

    Complete Linux Command Reference

    《Complete Linux Command Reference》是一本全面介绍Linux命令的权威指南,涵盖了从基础操作到高级技巧的广泛内容。在Linux操作系统中,命令行是系统管理、文件操作和程序控制的主要工具,掌握Linux命令对于任何IT...

    Linux常用的Command

    ### Linux常用命令详解 #### 一、文件管理 1. **ls** - `ls`:显示当前目录下的文件和目录。 - `ls -a`:列出当前目录下的所有文件,包括隐藏文件(以`.`开头)。 - `ls -l` 或 `ll`:以长格式显示当前目录下的...

    linux-Command-Reference.zip_linux

    这个"linux-Command-Reference.zip"压缩包包含了一份名为"linux.pdf"的文档,它很可能是对Linux命令的一个详尽参考,旨在帮助新手熟悉和实践Linux操作。 1. **命令行界面(CLI)**:Linux系统主要通过命令行界面来...

    用Linux Command Shell模拟DOS命令

    Linux Command Shell 模拟DOS命令是为习惯于Windows命令行环境的用户提供的一个便利工具。在Linux中,shell脚本是一种强大的自动化工具,能够执行各种任务,从简单的命令到复杂的程序逻辑。以下是对如何使用Linux ...

    Apress - Beginning The Linux Command Line, 2009.zip

    《Apress - Beginning The Linux Command Line, 2009》是一本专为初学者设计的Linux命令行指南。这本书全面介绍了Linux操作系统的基础知识,特别是关于命令行界面的使用,帮助用户掌握在没有图形化界面的情况下操作...

    uTools_插件_-_Linux_命令文档_utools-tpl-linux-command-docs.zip

    文档可能包含了Linux系统下常用的基本命令,例如文件管理命令(如ls, cp, mv)、文本处理命令(如grep, sed, awk)、网络通信命令(如ping, ifconfig)、权限管理命令(如chmod, chown)等。 Linux命令文档的主要...

    linux命令词典Linux+Command+Directory.zip

    这份电子书"epasser_1165212328602_(ebook)_o'reilly_-_linux_command_directory.pdf"旨在帮助读者理解和掌握Linux命令行环境中的操作技巧,提升工作效率。 1. **Linux命令基础** - **终端与Shell**:Linux命令...

    linux-command技巧

    ### Linux Command技巧详解 在Linux系统中,命令行操作是必不可少的一部分,对于高效地管理和使用系统至关重要。本文将深入解析给定的文件标题、描述及相关内容中的关键命令及其使用方法,帮助用户更好地理解和掌握...

    Linux Command List

    - `chmod`:更改文件或目录的权限,如 `chmod 755 dirname`。 - `cp`:复制文件,`cp from-filename to-filename`。 - `du`:查看目录占用的磁盘空间。 - `less` 和 `more`:分页查看文件内容,支持上下翻页。 ...

    The_Linux_Command_Line(中文版)

    ### Linux命令行基础知识点概述 #### 一、引言与目的 - **为什么使用命令行**:在Linux环境中,命令行界面(CLI)提供了一种高效且强大的方式来与操作系统进行交互...- **chmod命令**:用于更改文件或目录的权限设置。

    Linux命令笔记_linux-command.zip

    此外,Linux命令笔记还应该包括权限管理命令,如chmod、chown、chgrp等。这些命令分别用于修改文件或目录的权限、用户和组。掌握权限管理是保证Linux系统安全性的关键一环。 在系统管理方面,笔记中可能会包含进程...

    Apress.Beginning.The.Linux.Command.Line.2009

    《Apress Beginning The Linux Command Line 2009》是一本专为初学者设计的Linux命令行指南。这本书深入浅出地介绍了Linux操作系统的核心部分——命令行界面(CLI),是学习Linux操作系统的理想起点。完全免费的资源...

Global site tag (gtag.js) - Google Analytics