Linux賬號空閒登出、sudo命令使用

TaihangMeng發表於2016-08-06

一、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部落格 ” ,連結:http://blog.itpub.net/30776559/viewspace-2123086/,如需轉載,請註明出處,否則將追究法律責任。

相關文章