在我们使用Linux时,老司机都会说在一般情况下最好使用一般的账户,避免出现rm -rf /的问题,那么,我们如何管理一般的账户,使其有sudo的权限,但又是在可控的范围里,这里就需要关注/etc/sudoers这个文件了,它就是用来管理sudo权限的文件。 若是想普通用户uers1也能过上root的生活,请修改/etc/sudoers
user1 ALL(root) ALL
如果我们只是让user1能够修改其自己的或者其他用户的,但是,不能修改root用户的。用visudo,需要root权限,如下
user1 ALL(root) !/usr/bin/passwd,/usr/bin/passwd [a-zA-Z]*,!usr/bin/passwd root
这里就是不能使用passwd 和passwd root,其他的passwd都可以用。
还有一些其他的玩法,请转到
如果一个用户的shell是/sbin/nologin,而我们又想给其在使用这个用户时有一些提示,那么,我们就可以在/etc下编辑一个名叫nologin.txt的文件,这样就会给其在使用这个用户时一些友好的提示。 如/etc/nolgin.txt
This account is system account or others account.
Please DO NOT use this account to logn my Linux Server,Thank you for cooperations.
[root@localhost ~]# su - nobody
This account is system account or others account.
Please DO NOT use this account to logn my Linux Server,Thank you for cooperations.