<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "[Linux]如何限制只有特定群組的user才能變成root"]]></title>
		<link>https://forum.andowson.com/posts/list/16.page</link>
		<description><![CDATA[Latest messages posted in the topic "[Linux]如何限制只有特定群組的user才能變成root"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>[Linux]如何限制只有特定群組的user才能變成root</title>
				<description><![CDATA[ 1.開啟PuTTY連到您的Linux主機，用您的帳號登入後，切換為root身份，修改/etc/pam.d/su 
<br>
<br>
su - root 
<br>
vi /etc/pam.d/su 
<br>
# Uncomment the following line to require a user to be in the "wheel" group. 
<br>
[color=red]#[/color]auth required /lib/security/$ISA/pam_wheel.so use_uid 
<br>
將auth前面的＃拿掉，存檔後立即生效 
<br>
<br>
2.測試：原先的PuTTY先不要關掉(保持在root身份狀態)，請再開啟一個新PuTTY連到主機，用您的帳號再登入一次，測試能否成功執行su - root 
<br>
<br>
3.修正：回到原先的PuTTY視窗（這時還是root身份），將您的帳號加到[color=red]wheel[/color]群組，如 
<br>
usermod -a -G wheel sysadmin 
<br>
<br>
4.應用：後續如果有其他人也需要切換為root身份，例如您的代理人，則可以將他的帳號也加入wheel群組即可 
<br>
usermod -a -G wheel backupadm 
<br>
<br>
 :!:使用usermod記得養成加上-a的習慣，因為usermod -G 會將使用者加入後面的群組清單，如果您只是給新的群組清單，則他將會被從舊的群組移出。這可能會讓您被移出wheel群組，導致您無法切換為root！ 
<br>
<br>
參考資料：[url]http://www.l-penguin.idv.tw/~steven/article/pam_whell.htm[/url]]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/35/39.page</guid>
				<link>https://forum.andowson.com/posts/preList/35/39.page</link>
				<pubDate><![CDATA[Wed, 24 Jan 2007 13:51:29]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:[Linux]如何限制只有特定群組的user才能變成root</title>
				<description><![CDATA[ 如果日後要將使用者移出wheel群組 
<br>
可以透過vi /etc/group方式將使用者帳號由wheel:那列刪除。 
<br>
如果該使用者只有多加入wheel群組，則可以用下列指令來處理： 
<br>
[code]usermod -G "" username[/code] 
<br>
即將群組名稱設為空字串即可。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/35/941.page</guid>
				<link>https://forum.andowson.com/posts/preList/35/941.page</link>
				<pubDate><![CDATA[Fri, 24 Dec 2010 15:02:54]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>