- Mastering Linux Security and Hardening
- Donald A. Tevault
- 206字
- 2021-07-02 19:19:23
Letting users run as other users
In the following line, (ALL) means that Sylvester can run the systemctl commands as any user:
sylvester ALL=(ALL) /usr/bin/systemctl status sshd, /usr/bin/systemctl restart sshd
This effectively gives Sylvester root privileges for these commands because the root user is definitely any user. You could, if desired, change that (ALL) to (root) in order to specify that Sylvester can only run these commands as the root user:
sylvester ALL=(root) /usr/bin/systemctl status sshd, /usr/bin/systemctl restart sshd
Okay, there's probably not much point in that because nothing changes. Sylvester had root privileges for these systemctl commands before, and he still has them now. But, there are more practical uses for this feature. Let's say that Vicky is a database admin, and you want her to run as the database user:
vicky ALL=(database) /usr/local/sbin/some_database_script.sh
Vicky could then run the command as the database user by entering the following code:
sudo -u database some_database_script.sh
This is one of those features that you might not use that often, but keep it in mind anyway. You never know when it might come in handy.
Okay, this wraps it up for our discussion of sudo. Let's now turn our attention to ensuring the security of our regular users.
- Mobile Forensics Cookbook
- 腦洞大開:滲透測(cè)試另類實(shí)戰(zhàn)攻略
- 黑客攻防與無線安全從新手到高手(超值版)
- 數(shù)字化轉(zhuǎn)型浪潮下的數(shù)據(jù)安全最佳實(shí)踐指南
- 計(jì)算機(jī)網(wǎng)絡(luò)安全基礎(chǔ)(第5版)
- 從0到1:CTFer成長(zhǎng)之路
- 人工智能安全(精裝版)
- 電腦安全與攻防入門很輕松(實(shí)戰(zhàn)超值版)
- 黑客攻防從入門到精通
- 華為Anti-DDoS技術(shù)漫談
- 復(fù)雜信息系統(tǒng)網(wǎng)絡(luò)安全體系建設(shè)指南
- Learn Azure Sentinel
- 云計(jì)算安全:關(guān)鍵技術(shù)、原理及應(yīng)用
- Securing Network Infrastructure
- Web代碼安全漏洞深度剖析