Linux必学的60个命令(5) 下载本文

内容发布更新时间 : 2024/5/18 23:49:19星期一 下面是文章的全部内容请认真阅读。

Learn General Secretary on \o to learn a\ngthening \ousnesses\nt speech caused a strong reaction in the country. ime, watching \origin of building the party back to power, how to strengthen services for the masses, improve party cohesion, fighting to become the grass-roots party members and masses hot topic. Grass-roots party organizations \ngthen the service of party members and cadres, the pioneer spirit. Distribution of grass-roots party organizations in all walks of people, clothing, shelter, which belongs to the nerve endings of the party organization and comments reputation has a direct perception of the masses. Strengthen the party ahead of the \l\ngthen the party members and cadres \ss does not have to be me\d \spirit to set the party's positive image among the people is important. Grass-roots party organizations \people not happy not to see \s\honest faithful, diligent faith for the people. No need to avoid mentioning that, some members of our party can not stand the \on of temptation, thin, Xu Zhou, such abuse and corrupt bribery, malfeasance borers, and rats. Two, is to clean up, thin, Xu, Zhou's solution to restore the party's fresh and natural, solid and honest work style. Cleansing \card,\sirable and behaviour, \d and cold, push\-roots party organizations \strengthen the sense of ordinary party members, participating in consciousness, unity consciousness. For reasons known, members of grass-roots party branches less mobile, less resources, and the construction of party organizations have some lag. Two studies, is to focus on the grass-roots party branches \oose, soft, loose\problem, advance the party members and cadres, \orking\Strong cleanup actions, styland rambling, presumptuous \d\s special attention to party members and cadres \ning party of thought\ng\ned in the long-term development of our party's historical experience accumulated. Two is our party under the new historical conditions, strengthen the party's construction of a new \oots party organizations should always catch the hard work, results-oriented. Two educational outcomes are long-term oriented and become an important impetus for the work. \d have three kinds of consciousness \sic learning lies in the doing. Only the Constitution address the series of party rules, and do solid work, be qualified party members had a solid ideological basis. Only the \ng\do\y, to form a \earn-do-do\ctive of education. This requires that the Organization Linux必学的60个命令(5)-网络安全

Linux必学的60个命令:系统安全相关命令 Linux必学的系统安全命令 (1) 作者:曹元其 发文时间:2004.12.03

虽然Linux和Windows NT/2000系统一样是一个多用户的系统,但是它们之间有不少重要

的差别。对于很多习惯了Windows系统的管理员来讲,如何保证Linux操作系统安全、可靠将

会面临许多新的挑战。本文将重点介绍Linux系统安全的命令。

passwd

1.作用

passwd命令原来修改账户的登陆密码,使用权限是所有用户。

2.格式

passwd [选项] 账户名称

3.主要参数

-l:锁定已经命名的账户名称,只有具备超级用户权限的使用者方可使用。 -u:解开账户锁定状态,只有具备超级用户权限的使用者方可使用。 -x, --maximum=DAYS:最大密码使用时间(天),只有具备超级用户权限的使用者方可 使用。

-n, --minimum=DAYS:最小密码使用时间(天),只有具备超级用户权限的使用者方可 使用。

-d:删除使用者的密码, 只有具备超级用户权限的使用者方可使用。

-S:检查指定使用者的密码认证种类, 只有具备超级用户权限的使用者方可使用。

4.应用实例

$ passwd

Changing password for user cao. Changing password for cao (current) UNIX password: New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

从上面可以看到,使用passwd命令需要输入旧的密码,然后再输入两次新密码。

su

earning education, need three kinds of consciousness: one is to establish an integrated awareness. \Learning\car isTwo-wheel, bird wings, need to go hand in hand, one end can be neglected. Communist theoretician and man. Only by closely combining theory and practice together in order to truly realize their value. \ng\oundation is not strong, shaking; \net to net thousands of accounts. \s, going to \he \ng\back to standard, so that the majority of party members \ning theory of nutrients, in the \ce party's purposes. Second, to establish a sense of depth. \ning\drawn, entirely different, but the organic unity of the whole. \ning education, we need to explore integrating \\, exhibit \ence\he \ng\simple room instruction, \onotone fordoing. Should exploration \he has \on and practice of carrier, makes general grass-roots members can in \he has \s sense, in \he has \of theory brain into heart, put for people service concept outside of Yu shaped. Third, to adhere to long-term the awareness. Style construction on the road forever, \catch the long-term. \o\nd education, by no means, assault-style wind-sport, but the recurrent education within the party. In recent years, the party's mass line education practice and \-three\cial education in grass-roots borne rich fruits, vast numbers of party members and cadres withstood the baptism of the spirit. \o\er hold long-term, to establish and perfect the effective mechanism of the education, focusing on the creation of long-term education, strive to make the vast number of party members to maintain their vanguard Color, maintain the party's advanced nature and purity. Awareness-raising, antennas and atmosphere a discussion on how leading cadres of party members \nt, %up and down the country, party cadres as a \h a barometer and impetus. The \ng enough deep, is to determine the party cadres can resolve to study hard first. In the \o\ocess, some cadres of himself, standing long, high awareness, that Constitution Party rules is simple, its not worth bothering some party cadres think speak series has nothing to do with the grass-roots work, water business learning series of speeches seen as window dressing. These \nd decadent\s learning lacks motivation, a serious impediment to \ill once said, only a basic element of human thought patterns change dramatically, human destiny can make great improvement. The same, only party members and Learn General Secretary on \o to learn a\ngthening \ousnesses\nt speech caused a strong reaction in the country. ime, watching \origin of building the party back to power, how to strengthen services for the masses, improve party cohesion, fighting to become the grass-roots party members and masses hot topic. Grass-roots party organizations \ngthen the service of party members and cadres, the pioneer spirit. Distribution of grass-roots party organizations in all walks of people, clothing, shelter, which belongs to the nerve endings of the party organization and comments reputation has a direct perception of the masses. Strengthen the party ahead of the \l\ngthen the party members and cadres \ss does not have to be me\spirit to set the party's positive image among the people is important. Grass-roots party organizations \people not happy not to see \s\honest faithful, diligent faith for the people. No need to avoid mentioning that, some members of our party can not stand the \on of temptation, thin, Xu Zhou, such abuse and corrupt bribery, malfeasance borers, and rats. Two, is to clean up, thin, Xu, Zhou's solution to restore the party's fresh and natural, solid and honest work style. Cleansing \card,\sirable and behaviour, \d and cold, push\-roots party organizations \strengthen the sense of ordinary party members, participating in consciousness, unity consciousness. For reasons known, members of grass-roots party branches less mobile, less resources, and the construction of party organizations have some lag. Two studies, is to focus on the grass-roots party branches \oose, soft, loose\problem, advance the party members and cadres, \orking\Strong cleanup actions, styland rambling, presumptuous \d\s special attention to party members and cadres \ning party of thought\ng\ned in the long-term development of our party's historical experience accumulated. Two is our party under the new historical conditions, strengthen the party's construction of a new \oots party organizations should always catch the hard work, results-oriented. Two educational outcomes are long-term oriented and become an important impetus for the work. \d have three kinds of consciousness \sic learning lies in the doing. Only the Constitution address the series of party rules, and do solid work, be qualified party members had a solid ideological basis. Only the \ng\y, to form a \earn-do-do\ctive of education. This requires that the Organization 1.作用

su的作用是变更为其它使用者的身份,超级用户除外,需要键入该使用者的密码。

2.格式

su [选项]... [-] [USER [ARG]...]

3.主要参数

-f , --fast:不必读启动文件(如 csh.cshrc 等),仅用于csh或tcsh两种Shell。 -l , --login:加了这个参数之后,就好像是重新登陆为该使用者一样,大部分环境 变量(例如HOME、SHELL和USER等)都是以该使用者(USER)为主,并且工作目录也会改变

。如果没有指定USER,缺省情况是root。

-m, -p ,--preserve-environment:执行su时不改变环境变数。

-c command:变更账号为USER的使用者,并执行指令(command)后再变回原来使用者 。

USER:欲变更的使用者账号,ARG传入新的Shell参数。

4.应用实例

变更账号为超级用户,并在执行df命令后还原使用者。 su -c df root

umask

1.作用

umask设置用户文件和目录的文件创建缺省屏蔽值,若将此命令放入profile文件,就可 控制该用户后续所建文件的存取许可。它告诉系统在创建文件时不给谁存取许可。使用权限 是所有用户。

2.格式

umask [-p] [-S] [mode]

3.参数

-S:确定当前的umask设置。 -p:修改umask 设置。 [mode]:修改数值。

4.说明

传统Unix的umask值是022,这样就可以防止同属于该组的其它用户及别的组的用户修

改该用户的文件。既然每个用户都拥有并属于一个自己的私有组,那么这种“组保护模式” 就不在需要了。严密的权限设定构成了Linux安全的基础,在权限上犯错误是致命的。需要 注意的是,umask命令用来设置进程所创建的文件的读写权限,最保险的值是0077,即关闭

创建文件的进程以外的所有进程的读写权限,表示为-rw-------。在~/.bash_profile中,

earning education, need three kinds of consciousness: one is to establish an integrated awareness. \Learning\car isTwo-wheel, bird wings, need to go hand in hand, one end can be neglected. Communist theoretician and man. Only by closely combining theory and practice together in order to truly realize their value. \ng\oundation is not strong, shaking; \net to net thousands of accounts. \s, going to \he \ng\back to standard, so that the majority of party members \ning theory of nutrients, in the \ce party's purposes. Second, to establish a sense of depth. \ning\drawn, entirely different, but the organic unity of the whole. \ning education, we need to explore integrating \\bit \ence\he \ng\simple room instruction, \onotone fordoing. Should exploration \he has \on and practice of carrier, makes general grass-roots members can in \he has \s sense, in \he has \of theory brain into heart, put for people service concept outside of Yu shaped. Third, to adhere to long-term the awareness. Style construction on the road forever, \catch the long-term. \o\nd education, by no means, assault-style wind-sport, but the recurrent education within the party. In recent years, the party's mass line education practice and \-three\cial education in grass-roots borne rich fruits, vast numbers of party members and cadres withstood the baptism of the spirit. \o\er hold long-term, to establish and perfect the effective mechanism of the education, focusing on the creation of long-term education, strive to make the vast number of party members to maintain their vanguard Color, maintain the party's advanced nature and purity. Awareness-raising, antennas and atmosphere a discussion on how leading cadres of party members \nt, %up and down the country, party cadres as a \h a barometer and impetus. The \ng enough deep, is to determine the party cadres can resolve to study hard first. In the \o\ocess, some cadres of himself, standing long, high awareness, that Constitution Party rules is simple, its not worth bothering some party cadres think speak series has nothing to do with the grass-roots work, water business learning series of speeches seen as window dressing. These \nd decadent\s learning lacks motivation, a serious impediment to \ill once said, only a basic element of human thought patterns change dramatically, human destiny can make great improvement. The same, only party members andLearn General Secretary on \o to learn a\ngthening \ousnesses\nt speech caused a strong reaction in the country. ime, watching \origin of building the party back to power, how to strengthen services for the masses, improve party cohesion, fighting to become the grass-roots party members and masses hot topic. Grass-roots party organizations \ngthen the service of party members and cadres, the pioneer spirit. Distribution of grass-roots party organizations in all walks of people, clothing, shelter, which belongs to the nerve endings of the party organization and comments reputation has a direct perception of the masses. Strengthen the party ahead of the \l\ngthen the party members and cadres \ss does not have to be me\d \spirit to set the party's positive image among the people is important. Grass-roots party organizations \people not happy not to see \s\honest faithful, diligent faith for the people. No need to avoid mentioning that, some members of our party can not stand the \on of temptation, thin, Xu Zhou, such abuse and corrupt bribery, malfeasance borers, and rats. Two, is to clean up, thin, Xu, Zhou's solution to restore the party's fresh and natural, solid and honest work style. Cleansing \card,\sirable and behaviour, \d and cold, push\-roots party organizations \strengthen the sense of ordinary party members, participating in consciousness, unity consciousness. For reasons known, members of grass-roots party branches less mobile, less resources, and the construction of party organizations have some lag. Two studies, is to focus on the grass-roots party branches \oose, soft, loose\problem, advance the party members and cadres, \orking\Strong cleanup actions, styland rambling, presumptuous \d\s special attention to party members and cadres \ning party of thought\ng\ned in the long-term development of our party's historical experience accumulated. Two is our party under the new historical conditions, strengthen the party's construction of a new \oots party organizations should always catch the hard work, results-oriented. Two educational outcomes are long-term oriented and become an important impetus for the work. \d have three kinds of consciousness \sic learning lies in the doing. Only the Constitution address the series of party rules, and do solid work, be qualified party members had a solid ideological basis. Only the \ng\y, to form a \earn-do-do\ctive of education. This requires that the Organization加上一行命令umask 0077可以保证每次启动Shell后, 进程的umask权限都可以被正确设定。

5.应用实例

umask -S

u=rwx,g=rx,o=rx umask -p 177 umask -S u=rw,g=,o=

上述5行命令,首先显示当前状态,然后把umask值改为177,结果只有文件所有者具有

读写文件的权限,其它用户不能访问该文件。这显然是一种非常安全的设置。

chgrp

1.作用

chgrp表示修改一个或多个文件或目录所属的组。使用权限是超级用户。

2.格式

chgrp [选项]... 组 文件... 或

chgrp [选项]... --reference=参考文件 文件...

将每个<文件>的所属组设定为<组>。

3.参数

-c, --changes :像 --verbose,但只在有更改时才显示结果。

--dereference:会影响符号链接所指示的对象,而非符号链接本身。

-h, --no-dereference:会影响符号链接本身,而非符号链接所指示的目的地(当系统 支持更改符号链接的所有者,此选项才有效)。 -f, --silent, --quiet:去除大部分的错误信息。

--reference=参考文件:使用<参考文件>的所属组,而非指定的<组>。 -R, --recursive:递归处理所有的文件及子目录。 -v, --verbose:处理任何文件都会显示信息。

4.应用说明

该命令改变指定指定文件所属的用户组。其中group可以是用户组ID,也可以是

/etc/group文件中用户组的组名。文件名是以空格分开的要改变属组的文件列表,支持通配 符。如果用户不是该文件的属主或超级用户,则不能改变该文件的组。

5.应用实例

earning education, need three kinds of consciousness: one is to establish an integrated awareness. \Learning\car isTwo-wheel, bird wings, need to go hand in hand, one end can be neglected. Communist theoretician and man. Only by closely combining theory and practice together in order to truly realize their value. \ng\oundation is not strong, shaking; \net to net thousands of accounts. \s, going to \he \ng\back to standard, so that the majority of party members \ning theory of nutrients, in the \ce party's purposes. Second, to establish a sense of depth. \ning\drawn, entirely different, but the organic unity of the whole. \ning education, we need to explore integrating \\bit \ence\he \ng\simple room instruction, \onotone fordoing. Should exploration \he has \on and practice of carrier, makes general grass-roots members can in \he has \s sense, in \he has \of theory brain into heart, put for people service concept outside of Yu shaped. Third, to adhere to long-term the awareness. Style construction on the road forever, \catch the long-term. \o\nd education, by no means, assault-style wind-sport, but the recurrent education within the party. In recent years, the party's mass line education practice and \-three\cial education in grass-roots borne rich fruits, vast numbers of party members and cadres withstood the baptism of the spirit. \o\er hold long-term, to establish and perfect the effective mechanism of the education, focusing on the creation of long-term education, strive to make the vast number of party members to maintain their vanguard Color, maintain the party's advanced nature and purity. Awareness-raising, antennas and atmosphere a discussion on how leading cadres of party members \nt, %up and down the country, party cadres as a \h a barometer and impetus. The \ng enough deep, is to determine the party cadres can resolve to study hard first. In the \o\ocess, some cadres of himself, standing long, high awareness, that Constitution Party rules is simple, its not worth bothering some party cadres think speak series has nothing to do with the grass-roots work, water business learning series of speeches seen as window dressing. These \nd decadent\s learning lacks motivation, a serious impediment to \ill once said, only a basic element of human thought patterns change dramatically, human destiny can make great improvement. The same, only party members and