Skip to Content
可编程网络自动化
book

可编程网络自动化

by Jason Edelman, Scott S. Lowe, Matt Oswalt
January 2023
Intermediate to advanced
458 pages
14h 16m
Chinese
Posts & Telecom Press
Content preview from 可编程网络自动化
40
3
下面这个例子更复杂:为文件属主添加读
/
写权限,但是删除文件属组的写权限。
[vagrant@centos ~]$
chmod u+rw,g-w /opt/share/config.txt
chmod
命令还支持使用
-R
选项执行
递归
操作,这意味着权限改动也会影响到文件和子目录
(显然仅适用于对目录使用
chmod
)。
修改所有权和文件属组
鉴于文件所有权和文件属组在文件权限中扮演着不可或缺的角色,
Linux
然也提供了相应的工具来对其做出修改(
ls
命令用于查看所有权和属组,如
3-1
所示)。可以使用
chown
命令修改文件所有权,使用
chgrp
命令修改文
件属组。这两个命令和
chmod
一样,也支持递归操作选项
-R
现在要进入下一个与
Linux
交互的重要话题:运行程序。
3.4.3
 运行程序
有了前面的内容作为基础,运行程序其实很简单。要想运行程序,需要满足以下要求。
文件属于可执行文件(可以使用实用工具
file
来帮助判断文件是否可执行)。
执行权限(要么是文件属主或文件属组成员,要么是拥有执行权限的其他用户)。
上一节已经讨论过第二个要求,所以这里就不再赘述了。如果文件没有执行权限,那么根
据需要,使用
chmod
命令、
chown
命令和
chgrp
命令设置即可。不过第一个要求(可执行文
件)值得多说两句。
怎样才算是“可执行文件”?可执行文件必须是二进制文件,由编程语言(比如
C
C++
编译而来。不过,也可以是可执行的文本文件,比如
bash
shell
脚本(包含一系列的
bash
shell
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

弱监督学习实用指南

弱监督学习实用指南

Wee Hyong Tok, Amit Bahree, Senja Filipi
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787115606181