|
visudo:
- oracle ALL=(ALL) /usr/bin/id
- user1 ALL=(ALL) NOPASSWD: /usr/bin/id
- User_Alias USER2 = user2
- Cmnd_Alias USERL = /usr/sbin/usermod -L oracle
- USER2 ALL=(ALL) NOPASSWD: USERL
复制代码 细分命令要用Cmnd_Alias,效果:
-bash-4.2# su - user2
Last login: Sat Apr 20 09:52:32 EDT 2019 on pts/0
[user2@station61 ~]$ usermod -L oracle
-bash: /usr/sbin/usermod: Permission denied
[user2@station61 ~]$ sudo usermod -L oracle
[user2@station61 ~]$ sudo usermod -U oracle
[sudo] 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: 增加硬链接,时间属性变化情况
供参考:
- [user2@station61 ~]$ ls
- hello.txt user2d user2.txt
- [user2@station61 ~]$ 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: -
- [user2@station61 ~]$ cd user2d
- [user2@station61 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: -
- [user2@station61 user2d]$ ls
- [user2@station61 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 10:08:08.678202749 -0400
- Modify: 2019-04-20 08:37:56.158903357 -0400
- Change: 2019-04-20 08:37:56.158903357 -0400
- Birth: -
- [user2@station61 user2d]$ tocuh a
- bash: tocuh: command not found...
- Similar command is: 'touch'
- [user2@station61 user2d]$ touch a
- [user2@station61 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 10:08:08.678202749 -0400
- Modify: 2019-04-20 10:08:35.490376347 -0400
- Change: 2019-04-20 10:08:35.490376347 -0400
- Birth: -
- [user2@station61 user2d]$ chmod 700 ./
- [user2@station61 user2d]$ 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: -
- [user2@station61 user2d]$
复制代码
|
|