另外:如果其他用户没有根目录的读权限的话,即使在root用户下,用su - 也是无法切换普通用户的。
今天尝试用perl获取权限,在安全加固前备份所有的修改权限的文件的原始权限;
sxb102:/export/home # cat bak.pl
#!/usr/bin/perl
$mode = (stat("./test"))[2];
printf "%04o\n", ($mode & 007777);
sxb102:/export/home # ls -l ./test
-rwsr-xr-x 1 root root 0 Apr 12 23:32 ./test
sxb102:/export/home # stat ./test
File: `./test'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 116506 Links: 1
Access: (4755/-rwsr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-04-12 23:32:00.000000000 +0800
Modify: 2008-04-12 23:32:00.000000000 +0800
Change: 2008-04-12 23:32:54.000000000 +0800
sxb102:/export/home # chmod 3666 ./test
sxb102:/export/home # ls -l
total 20
-rwxr-xr-x 1 root root 6495 Apr 6 23:20 a
-rw-r--r-- 1 root root 123 Apr 6 23:20 a.c
-rwxr-xr-x 1 root root 20 Apr 12 22:13 a.pl
-rwxr-xr-x 1 root root 80 Apr 12 23:35 bak.pl
-rw-rwSrwT 1 root root 0 Apr 12 23:32 test
sxb102:/export/home # stat ./test
File: `./test'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 116506 Links: 1
Access: (3666/-rw-rwSrwT) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-04-12 23:32:00.000000000 +0800
Modify: 2008-04-12 23:32:00.000000000 +0800
Change: 2008-04-12 23:35:55.000000000 +0800
sxb102:/export/home # ./bak.pl
3666
阅读(2552) | 评论(0) | 转发(0) |