禁随意改root密码

 

lsattr 主要参数如表。
  -a  显示所有文件和目录,包括以"."为名称开头字符的额外内建,现行目录"."与上层目录".."-d  显示,目录名称,而非其内容。 
  -l  此参数目前没有任何作用。 
  -R  递归处理,将指定目录下的所有文件及子目录一并处理。 
  -v  显示文件或目录版本。 
  -V  显示版本信息。

 

LSATTR(1)                                                            LSATTR(1)



NAME
       lsattr - list file attributes on a Linux second extended
       file system

SYNOPSIS
       lsattr [ -RVadv ] [ files...  ]

DESCRIPTION
       lsattr lists the file attributes on  a  second  extended
       file  system.   See  chattr(1)  for a description of the
       attributes and what they mean.

OPTIONS
       -R     Recursively list attributes  of  directories  and
              their contents.

       -V     Display the program version.

       -a     List  all  files  in directories, including files
              that start with ‘.’.

       -d     List directories like other  files,  rather  than
              listing their contents.

       -v     List the file’s version/generation number.

AUTHOR
       lsattr  was  written by Remy Card <Remy.Card@linux.org>.
       It  is  currently  being  maintained  by  Theodore  Ts’o
       <tytso@alum.mit.edu>.

BUGS
       There are none :-).

上面是表明passwd改密码错误

chattr +i file #这个i可以让一个文档不能被删除,改名,设定连结也无法写入或新增资料!(注意:如果去掉这个属性是chattr -i file 是"-"号)

上图可见/etc/passwd文件已经加入了i这个特性,所以不能修改这个文件!

4

当去掉i属性时,就没问题了!

注意lsattr -v file是显示文件的特性!

实例:

➜  Desktop lsattr -d ak
----i--------e- ak

删除失败:

➜  Desktop rm -rf ak 
rm: cannot remove `ak': Operation not permitted
➜  Desktop chattr -i ak
➜  Desktop lsattr -d ak     
-------------e- ak
➜  Desktop rm -rf ak 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值