课程第8次
visudo:oracle ALL=(ALL) /usr/bin/id
user1ALL=(ALL) NOPASSWD: /usr/bin/id
User_Alias USER2 = user2
Cmnd_Alias USERL = /usr/sbin/usermod -L oracle
USER2ALL=(ALL)NOPASSWD: USERL
细分命令要用Cmnd_Alias,效果:
-bash-4.2# su - user2
Last login: Sat Apr 20 09:52:32 EDT 2019 on pts/0
$ usermod -L oracle
-bash: /usr/sbin/usermod: Permission denied
$ sudousermod -L oracle
$ sudousermod -U oracle
password for user2:
Sorry, user user2 is not allowed to execute '/sbin/usermod -U oracle' as root on station61.example.com.---------------------------------------------
a:进入目录,时间属性变化情况
b:在该目录下,建立新文件或新目录,时间属性变化情况
c:移动目录,时间属性变化情况
d:cp目录,时间属性变化情况
e:在该目录下,ls -l 时,时间属性变化情况
f: 增加硬链接,时间属性变化情况
供参考:
$ ls
hello.txtuser2duser2.txt
$ stat user2d
File: ‘user2d’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 130833 Links: 2
Access: (0775/drwxrwxr-x)Uid: ( 1003/ user2) Gid: ( 1003/ user2)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-04-20 08:37:56.158903357 -0400
Modify: 2019-04-20 08:37:56.158903357 -0400
Change: 2019-04-20 08:37:56.158903357 -0400
Birth: -
$ cd user2d
$ stat .
File: ‘.’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 130833 Links: 2
Access: (0775/drwxrwxr-x)Uid: ( 1003/ user2) Gid: ( 1003/ user2)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-04-20 08:37:56.158903357 -0400
Modify: 2019-04-20 08:37:56.158903357 -0400
Change: 2019-04-20 08:37:56.158903357 -0400
Birth: -
$ ls
$ stat .
File: ‘.’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 130833 Links: 2
Access: (0775/drwxrwxr-x)Uid: ( 1003/ user2) Gid: ( 1003/ user2)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-04-20 10:08:08.678202749 -0400
Modify: 2019-04-20 08:37:56.158903357 -0400
Change: 2019-04-20 08:37:56.158903357 -0400
Birth: -
$ tocuh a
bash: tocuh: command not found...
Similar command is: 'touch'
$ touch a
$ stat .
File: ‘.’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 130833 Links: 2
Access: (0775/drwxrwxr-x)Uid: ( 1003/ user2) Gid: ( 1003/ user2)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-04-20 10:08:08.678202749 -0400
Modify: 2019-04-20 10:08:35.490376347 -0400
Change: 2019-04-20 10:08:35.490376347 -0400
Birth: -
$ chmod 700 ./
$ stat .
File: ‘.’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 130833 Links: 2
Access: (0700/drwx------)Uid: ( 1003/ user2) Gid: ( 1003/ user2)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-04-20 10:08:08.678202749 -0400
Modify: 2019-04-20 10:08:35.490376347 -0400
Change: 2019-04-20 10:08:58.768526982 -0400
Birth: -
$
页:
[1]