<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automate switch user in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246325#M60832</link>
    <description>Combining su and sudo means you're first transitioning to root, and then to target user. The logs will reflect that. Sometimes, seeing a message about JoeUser becoming root can cause undue agitation in security auditors.&lt;BR /&gt;&lt;BR /&gt;If you have a relatively modern version of sudo, the effect of:&lt;BR /&gt;&lt;BR /&gt;sudo su - &lt;USER&gt; -c &lt;COMMAND...&gt;&lt;BR /&gt;&lt;BR /&gt;can be exactly replicated with:&lt;BR /&gt;&lt;BR /&gt;sudo -u &lt;USER&gt; -i &lt;COMMAND...&gt;&lt;BR /&gt;&lt;BR /&gt;It will also consolidate all the essential information into one log line: JoeUser becomes &lt;USER&gt; for the purpose of running the &lt;COMMAND&gt;.&lt;BR /&gt;&lt;BR /&gt;Of course, to use "sudo -i" effectively, your sudoers file must be written to say what you really mean: instead of&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(root) su - &lt;USER&gt; &lt;COMMAND&gt;&lt;BR /&gt;&lt;BR /&gt;you should write:&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(&lt;USER&gt;) ALL&lt;BR /&gt;&lt;BR /&gt;If you need to allow JoeUser to execute a particular command automatically, without prompting a password, you might write:&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(&lt;USER&gt;) NOPASSWD: &lt;COMMAND&gt;&lt;BR /&gt;&lt;BR /&gt;(OK, I admit: this is my pet peeve. But I see "sudo su - ..." as a nothing more than a bad habit, encouraged by sloppy sudoers rule writing practices.)&lt;BR /&gt;&lt;BR /&gt;MK&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/USER&gt;&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/COMMAND...&gt;&lt;/USER&gt;&lt;/COMMAND...&gt;&lt;/USER&gt;</description>
    <pubDate>Mon, 05 Jul 2010 16:26:45 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2010-07-05T16:26:45Z</dc:date>
    <item>
      <title>Automate switch user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246323#M60830</link>
      <description>Hi, it's possible to automate the use of "su" command??&lt;BR /&gt;I refer to the issue of the introduction of the password.&lt;BR /&gt;There is something like this: &lt;BR /&gt;su - username/password???&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 05 Jul 2010 10:52:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246323#M60830</guid>
      <dc:creator>ivanrc</dc:creator>
      <dc:date>2010-07-05T10:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Automate switch user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246324#M60831</link>
      <description>You can use "sudo" instad of su. Or maybe a combination of both, for example:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sudo su - user -c "command"&lt;BR /&gt;&lt;BR /&gt;You need to configure the sudoers file with the visudo command.&lt;BR /&gt;&lt;BR /&gt;Check for information about sudo in google.&lt;BR /&gt;&lt;BR /&gt;Cheers.</description>
      <pubDate>Mon, 05 Jul 2010 15:18:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246324#M60831</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2010-07-05T15:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automate switch user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246325#M60832</link>
      <description>Combining su and sudo means you're first transitioning to root, and then to target user. The logs will reflect that. Sometimes, seeing a message about JoeUser becoming root can cause undue agitation in security auditors.&lt;BR /&gt;&lt;BR /&gt;If you have a relatively modern version of sudo, the effect of:&lt;BR /&gt;&lt;BR /&gt;sudo su - &lt;USER&gt; -c &lt;COMMAND...&gt;&lt;BR /&gt;&lt;BR /&gt;can be exactly replicated with:&lt;BR /&gt;&lt;BR /&gt;sudo -u &lt;USER&gt; -i &lt;COMMAND...&gt;&lt;BR /&gt;&lt;BR /&gt;It will also consolidate all the essential information into one log line: JoeUser becomes &lt;USER&gt; for the purpose of running the &lt;COMMAND&gt;.&lt;BR /&gt;&lt;BR /&gt;Of course, to use "sudo -i" effectively, your sudoers file must be written to say what you really mean: instead of&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(root) su - &lt;USER&gt; &lt;COMMAND&gt;&lt;BR /&gt;&lt;BR /&gt;you should write:&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(&lt;USER&gt;) ALL&lt;BR /&gt;&lt;BR /&gt;If you need to allow JoeUser to execute a particular command automatically, without prompting a password, you might write:&lt;BR /&gt;&lt;BR /&gt;JoeUser  ALL=(&lt;USER&gt;) NOPASSWD: &lt;COMMAND&gt;&lt;BR /&gt;&lt;BR /&gt;(OK, I admit: this is my pet peeve. But I see "sudo su - ..." as a nothing more than a bad habit, encouraged by sloppy sudoers rule writing practices.)&lt;BR /&gt;&lt;BR /&gt;MK&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/USER&gt;&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/COMMAND&gt;&lt;/USER&gt;&lt;/COMMAND...&gt;&lt;/USER&gt;&lt;/COMMAND...&gt;&lt;/USER&gt;</description>
      <pubDate>Mon, 05 Jul 2010 16:26:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246325#M60832</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2010-07-05T16:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automate switch user</title>
      <link>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246326#M60833</link>
      <description>THX.</description>
      <pubDate>Tue, 06 Jul 2010 05:05:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/automate-switch-user/m-p/5246326#M60833</guid>
      <dc:creator>ivanrc</dc:creator>
      <dc:date>2010-07-06T05:05:05Z</dc:date>
    </item>
  </channel>
</rss>

