“getfacl: Removing leading '/' from absolute path names”解决办法

[root@raclhr-11gR2-N1 ~]# getfacl -R /u01/app  > /tmp/bk_lhr_perm_u01_rac1.txt
getfacl: Removing leading '/' from absolute path names
[root@raclhr-11gR2-N1 ~]# head -n 6 /tmp/bk_lhr_perm_u01_rac1.txt
# file: u01/app
# owner: root
# group: oinstall
user::rwx
group::r-x
other::r-x
[root@raclhr-11gR2-N1 ~]# getfacl -pR /u01/app  > /tmp/bk_lhr_perm_u01_rac1.txt  
[root@raclhr-11gR2-N1 ~]# 
[root@raclhr-11gR2-N1 ~]# head -n 6 /tmp/bk_lhr_perm_u01_rac1.txt              
# file: /u01/app
# owner: root
# group: oinstall
user::rwx
group::r-x
other::r-x
[root@raclhr-11gR2-N1 ~]#

 


解决:加上-p参数即可。


-p, --absolute-names
       Do not strip leading slash characters (`/'). The  default  behavior
       is to strip leading slash characters.

 


从getfacl的手册页:



-p, --absolute-names       Do not strip leading slash characters (`/'). The  default  behavior
       is to strip leading slash characters.

 

在不使用-p开关的情况下提供绝对路径时会发出警告消息.

当给getfacl命令提供绝对路径时,输出是不同的.

没有-p开关:


$getfacl /path/foo/bar
getfacl: Removing leading '/' from absolute path names# file: path/foo/bar[Output truncated...]

 

请注意,仅当使用-p开关时,文件路径中的前导斜杠才会显示.


$getfacl -p /path/foo/bar# file: /path/foo/bar[Output truncated...]

 

当您通过管道输出进行进一步处理时,-p对于保持前导斜杠非常有用.

当给getfacl命令赋予相对路径时,输出是相同的.


$getfacl bar# file: bar[Output truncated...]

 

没有变化:


$getfacl -p bar# file: bar[Output truncated...]