一、Linux账号空闲登出(Idel logout)
-
vi /etc/profile 添加:
-
-
export TMOUT=900
二、sudo命令使用
编辑/etc/sudoers文件,按照示例root的格式,添加相应账号
-
[root@TaylonMeng ~]# visudo 或 vi /etc/sudoers
-
-
## Allow root to run any commands anywhere
-
root ALL=(ALL) ALL
-
oracle ALL=(ALL) ALL
-u:后接欲切换的用户,若不加,则为root
-
[oracle@TaylonMeng ~]$ more /etc/shadow
-
/etc/shadow: Permission denied
-
[oracle@TaylonMeng ~]$ sudo -u root more /etc/shadow
-
-
We trust you have received the usual lecture from the local System
-
Administrator. It usually boils down to these three things:
-
-
#1) Respect the privacy of others.
-
#2) Think before you type.
-
#3) With great power comes great responsibility.
-
-
[sudo] password for oracle:
-
root:$6$fwjcKvgG$pX73atu/RvAiXaYv1QWh4Y6QSFaMROAvbQXKkeLHjvVL6lnY7FPYuEAC3ASHCuH
-
nFReg4lgrzOLXwRWxlSWNV0:16936:0:99999:7:::
-
bin:*:15937:0:99999:7:::
-
daemon:*:15937:0:99999:7:::
-
adm:*:15937:0:99999:7:::
-
lp:*:15937:0:99999:7:::
-
sync:*:15937:0:99999:7:::
-
-
[oracle@TaylonMeng ~]$ sudo more /etc/shadow
-
root:$6$fwjcKvgG$pX73atu/RvAiXaYv1QWh4Y6QSFaMROAvbQXKkeLHjvVL6lnY7FPYuEAC3ASHCuH
-
nFReg4lgrzOLXwRWxlSWNV0:16936:0:99999:7:::
-
bin:*:15937:0:99999:7:::
-
daemon:*:15937:0:99999:7:::
-
adm:*:15937:0:99999:7:::
-
lp:*:15937:0:99999:7:::
-
sync:*:15937:0:99999:7:::
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30776559/viewspace-2123086/
,如需转载,请注明出处,否则将追究法律责任。