Bo's Oracle Station

查看: 1830|回复: 0

课程第8次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-4-20 21:56:25 | 显示全部楼层 |阅读模式
visudo:
  1. oracle ALL=(ALL)   /usr/bin/id
  2. user1  ALL=(ALL)     NOPASSWD: /usr/bin/id

  3. User_Alias USER2 = user2
  4. Cmnd_Alias USERL = /usr/sbin/usermod -L oracle

  5. 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:   增加硬链接,时间属性变化情况


供参考:
  1. [user2@station61 ~]$ ls
  2. hello.txt  user2d  user2.txt
  3. [user2@station61 ~]$ stat user2d
  4.   File: ‘user2d’
  5.   Size: 4096            Blocks: 8          IO Block: 4096   directory
  6. Device: 802h/2050d      Inode: 130833      Links: 2
  7. Access: (0775/drwxrwxr-x)  Uid: ( 1003/   user2)   Gid: ( 1003/   user2)
  8. Context: unconfined_u:object_r:etc_runtime_t:s0
  9. Access: 2019-04-20 08:37:56.158903357 -0400
  10. Modify: 2019-04-20 08:37:56.158903357 -0400
  11. Change: 2019-04-20 08:37:56.158903357 -0400
  12. Birth: -
  13. [user2@station61 ~]$ cd user2d
  14. [user2@station61 user2d]$ stat .
  15.   File: ‘.’
  16.   Size: 4096            Blocks: 8          IO Block: 4096   directory
  17. Device: 802h/2050d      Inode: 130833      Links: 2
  18. Access: (0775/drwxrwxr-x)  Uid: ( 1003/   user2)   Gid: ( 1003/   user2)
  19. Context: unconfined_u:object_r:etc_runtime_t:s0
  20. Access: 2019-04-20 08:37:56.158903357 -0400
  21. Modify: 2019-04-20 08:37:56.158903357 -0400
  22. Change: 2019-04-20 08:37:56.158903357 -0400
  23. Birth: -
  24. [user2@station61 user2d]$ ls
  25. [user2@station61 user2d]$ stat .
  26.   File: ‘.’
  27.   Size: 4096            Blocks: 8          IO Block: 4096   directory
  28. Device: 802h/2050d      Inode: 130833      Links: 2
  29. Access: (0775/drwxrwxr-x)  Uid: ( 1003/   user2)   Gid: ( 1003/   user2)
  30. Context: unconfined_u:object_r:etc_runtime_t:s0
  31. Access: 2019-04-20 10:08:08.678202749 -0400
  32. Modify: 2019-04-20 08:37:56.158903357 -0400
  33. Change: 2019-04-20 08:37:56.158903357 -0400
  34. Birth: -
  35. [user2@station61 user2d]$ tocuh a
  36. bash: tocuh: command not found...
  37. Similar command is: 'touch'
  38. [user2@station61 user2d]$ touch a
  39. [user2@station61 user2d]$ stat .
  40.   File: ‘.’
  41.   Size: 4096            Blocks: 8          IO Block: 4096   directory
  42. Device: 802h/2050d      Inode: 130833      Links: 2
  43. Access: (0775/drwxrwxr-x)  Uid: ( 1003/   user2)   Gid: ( 1003/   user2)
  44. Context: unconfined_u:object_r:etc_runtime_t:s0
  45. Access: 2019-04-20 10:08:08.678202749 -0400
  46. Modify: 2019-04-20 10:08:35.490376347 -0400
  47. Change: 2019-04-20 10:08:35.490376347 -0400
  48. Birth: -
  49. [user2@station61 user2d]$ chmod 700 ./
  50. [user2@station61 user2d]$ stat .
  51.   File: ‘.’
  52.   Size: 4096            Blocks: 8          IO Block: 4096   directory
  53. Device: 802h/2050d      Inode: 130833      Links: 2
  54. Access: (0700/drwx------)  Uid: ( 1003/   user2)   Gid: ( 1003/   user2)
  55. Context: unconfined_u:object_r:etc_runtime_t:s0
  56. Access: 2019-04-20 10:08:08.678202749 -0400
  57. Modify: 2019-04-20 10:08:35.490376347 -0400
  58. Change: 2019-04-20 10:08:58.768526982 -0400
  59. Birth: -
  60. [user2@station61 user2d]$
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-19 17:55 , Processed in 0.040281 second(s), 24 queries .

快速回复 返回顶部 返回列表