ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux账号空闲登出、sudo命令使用

Linux账号空闲登出、sudo命令使用

原创 Linux操作系统 作者:TaihangMeng 时间:2016-08-06 21:18:08 0 删除 编辑

一、Linux账号空闲登出(Idel logout)

  1. vi /etc/profile 添加:

  2. export TMOUT=900



二、sudo命令使用

编辑/etc/sudoers文件,按照示例root的格式,添加相应账号

  1. [root@TaylonMeng ~]# visudo 或 vi /etc/sudoers

  2. ## Allow root to run any commands anywhere
  3. root ALL=(ALL) ALL
  4. oracle ALL=(ALL) ALL
-u:后接欲切换的用户,若不加,则为root

  1. [oracle@TaylonMeng ~]$ more /etc/shadow
  2. /etc/shadow: Permission denied
  3. [oracle@TaylonMeng ~]$ sudo -u root more /etc/shadow

  4. We trust you have received the usual lecture from the local System
  5. Administrator. It usually boils down to these three things:

  6.     #1) Respect the privacy of others.
  7.     #2) Think before you type.
  8.     #3) With great power comes great responsibility.

  9. [sudo] password for oracle:
  10. root:$6$fwjcKvgG$pX73atu/RvAiXaYv1QWh4Y6QSFaMROAvbQXKkeLHjvVL6lnY7FPYuEAC3ASHCuH
  11. nFReg4lgrzOLXwRWxlSWNV0:16936:0:99999:7:::
  12. bin:*:15937:0:99999:7:::
  13. daemon:*:15937:0:99999:7:::
  14. adm:*:15937:0:99999:7:::
  15. lp:*:15937:0:99999:7:::
  16. sync:*:15937:0:99999:7:::

  17. [oracle@TaylonMeng ~]$ sudo more /etc/shadow
  18. root:$6$fwjcKvgG$pX73atu/RvAiXaYv1QWh4Y6QSFaMROAvbQXKkeLHjvVL6lnY7FPYuEAC3ASHCuH
  19. nFReg4lgrzOLXwRWxlSWNV0:16936:0:99999:7:::
  20. bin:*:15937:0:99999:7:::
  21. daemon:*:15937:0:99999:7:::
  22. adm:*:15937:0:99999:7:::
  23. lp:*:15937:0:99999:7:::
  24. sync:*:15937:0:99999:7:::




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30776559/viewspace-2123086/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-01-07

  • 博文量
    101
  • 访问量
    147093