<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><p>Sorry.  following way does NOT work.</p><p><br></p><p>user1 (ALL)=user2 /bin/bash</p>
<p>Leave off su entirely and</p>
<p>sudo -H user2 -i </p>
<p>as user1</p><br><br>--- <b>10/8/19 (四),James Hogarth <i><james.hogarth@gmail.com></i></b> 寫道:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>寄件者: James Hogarth <james.hogarth@gmail.com><br>主旨: Re: [CentOS] how to setup account which can 'su" to another account (NON-root)?<br>收件者: "CentOS mailing list" <centos@centos.org><br>日期: 2010年8月19日,四,上午11:22<br><br><div id="yiv1461927656"><p>Better still would be</p>
<p>user1 (ALL)=user2 /bin/bash</p>
<p>Leave off su entirely and</p>
<p>sudo -H user2 -i </p>
<p>as user1</p>
<p>On 19 Aug 2010 15:57, "mcclnx mcc" <<a rel="nofollow" ymailto="mailto:mcclnx@yahoo.com.tw" target="_blank" href="/mc/compose?to=mcclnx@yahoo.com.tw">mcclnx@yahoo.com.tw</a>> wrote:<br>> This work correctly.  Thanks.<br>> <br>> --- 10/8/19 (四),John Kennedy <<a rel="nofollow" ymailto="mailto:skebi69@gmail.com" target="_blank" href="/mc/compose?to=skebi69@gmail.com">skebi69@gmail.com</a>> 寫道:<br>
> <br>> 寄件者: John Kennedy <<a rel="nofollow" ymailto="mailto:skebi69@gmail.com" target="_blank" href="/mc/compose?to=skebi69@gmail.com">skebi69@gmail.com</a>><br>> 主旨: Re: [CentOS] how to setup account which can 'su" to another account (NON-root)?<br>> 收件者: "CentOS mailing list" <<a rel="nofollow" ymailto="mailto:centos@centos.org" target="_blank" href="/mc/compose?to=centos@centos.org">centos@centos.org</a>><br>
> 日期: 2010年8月19日,四,上午10:00<br>> <br>> <br>> <br>> On Thu, Aug 19, 2010 at 9:56 AM, mcclnx mcc <<a rel="nofollow" ymailto="mailto:mcclnx@yahoo.com.tw" target="_blank" href="/mc/compose?to=mcclnx@yahoo.com.tw">mcclnx@yahoo.com.tw</a>> wrote:<br>> <br>> Thank you for answer.  The problem I have is "user1" need "su" privilege.  If I grant "su" privilege, it can "su" to anyone.  What I want is user1 can ONLY "su" to user2.<br>
> <br>> <br>> <br>> <br>> my /etc/sudoers setup:<br>> <br>> <br>> <br>>   # User privilege specification<br>> <br>> root    ALL=(ALL) ALL<br>> <br>> user1   ALL=(root) /bin/su<br>> <br>
> <br>> <br>> <br>> <br>> any ideal to fix it?<br>> <br>> <br>> <br>> <br>> <br>> <br>> Use complete command like this:user1 ALL=(root) /bin/su - user2This will limit user1 to that specific command. You can add -NOPASSWD and user1 will not have to enter their password.<br>
> John-- <br>>  John Kennedy<br>> <br>> <br>> <br>> -----內含下列夾帶檔案-----<br>> <br>> _______________________________________________<br>> CentOS mailing list<br>> <a rel="nofollow" ymailto="mailto:CentOS@centos.org" target="_blank" href="/mc/compose?to=CentOS@centos.org">CentOS@centos.org</a><br>
> <a rel="nofollow" target="_blank" href="http://lists.centos.org/mailman/listinfo/centos">http://lists.centos.org/mailman/listinfo/centos</a><br>> <br>> <br>> <br>>       <br></p>
</div><br>-----內含下列夾帶檔案-----<br><br><div class="plainMail">_______________________________________________<br>CentOS mailing list<br><a ymailto="mailto:CentOS@centos.org" href="/mc/compose?to=CentOS@centos.org">CentOS@centos.org</a><br><a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br></div></blockquote></td></tr></table><br>