- Mastering Linux Security and Hardening
- Donald A. Tevault
- 495字
- 2021-07-02 19:19:20
The advantages of using sudo
Used properly, the sudo utility can greatly enhance the security of your systems, and it can make an administrator's job much easier. With sudo, you can do the following:
- Assign certain users full administrative privileges, while assigning other users only the privileges they need to perform tasks that are directly related to their respective jobs.
- Allow users to perform administrative tasks by entering their own normal user passwords so that you don't have to distribute the root password to everybody and his brother.
- Make it harder for intruders to break into your systems. If you implement sudo and disable the root user account, would-be intruders won't know which account to attack because they won't know which one has admin privileges.
- Create sudo policies that you can deploy across an entire enterprise network even if that network has a mix of Unix, BSD, and Linux machines.
- Improve your auditing capabilities because you'll be able to see what users are doing with their admin privileges.
In regards to that last bullet point, consider the following snippet from the secure log of my CentOS 7 virtual machine:
Sep 29 20:44:33 localhost sudo: donnie : TTY=pts/0 ; PWD=/home/donnie ; USER=root ; COMMAND=/bin/su -
Sep 29 20:44:34 localhost su: pam_unix(su-l:session): session opened for user root by donnie(uid=0)
Sep 29 20:50:39 localhost su: pam_unix(su-l:session): session closed for user root
You can see that I used su - to log in to the root command prompt and that I then logged back out. While I was logged in, I did several things that require root privileges, but none of that got recorded. What did get recorded though is something that I did with sudo. That is, because the root account is disabled on this machine, I used my sudo privilege to get su - to work for me. Let's look at another snippet to show a bit more detail about how this works:
Sep 29 20:50:45 localhost sudo: donnie : TTY=pts/0 ; PWD=/home/donnie ; USER=root ; COMMAND=/bin/less /var/log/secure
Sep 29 20:55:30 localhost sudo: donnie : TTY=pts/0 ; PWD=/home/donnie ; USER=root ; COMMAND=/sbin/fdisk -l
Sep 29 20:55:40 localhost sudo: donnie : TTY=pts/0 ; PWD=/home/donnie ; USER=root ; COMMAND=/bin/yum upgrade
Sep 29 20:59:35 localhost sudo: donnie : TTY=tty1 ; PWD=/home/donnie ; USER=root ; COMMAND=/bin/systemctl status sshd
Sep 29 21:01:11 localhost sudo: donnie : TTY=tty1 ; PWD=/home/donnie ; USER=root ; COMMAND=/bin/less /var/log/secure
This time, I used my sudo privilege to open a log file, to view my hard drive configuration, to perform a system update, to check the status of the Secure Shell daemon, and to once again view a log file. So, if you were the security administrator at my company, you'd be able to see whether or not I'm abusing my sudo power.
Now, you're asking, "What's to prevent a person from just doing a sudo su - to prevent his or her misdeeds from being detected?" That's easy. Just don't give people the power to go to the root command prompt.
- Extending Symfony2 Web Application Framework
- Metasploit Penetration Testing Cookbook(Third Edition)
- .NET安全攻防指南(上冊(cè))
- 黑客攻防與無(wú)線安全從新手到高手(超值版)
- 防火墻技術(shù)與應(yīng)用(第2版)
- 網(wǎng)絡(luò)安全技術(shù)與實(shí)訓(xùn)(第4版)(微課版)
- 模糊測(cè)試:強(qiáng)制發(fā)掘安全漏洞的利器
- 信息安全等級(jí)保護(hù)測(cè)評(píng)與整改指導(dǎo)手冊(cè)
- 網(wǎng)絡(luò)安全態(tài)勢(shì)感知
- End to End GUI Development with Qt5
- 隱私計(jì)算:推進(jìn)數(shù)據(jù)“可用不可見”的關(guān)鍵技術(shù)
- 網(wǎng)絡(luò)安全實(shí)戰(zhàn)詳解(企業(yè)專供版)
- 黑客攻擊與防范實(shí)戰(zhàn)從入門到精通
- 5G網(wǎng)絡(luò)安全規(guī)劃與實(shí)踐
- CCNA Security 210-260 Certification Guide