Configuring Sudo

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Style and format editing)
(One intermediate revision by one user not shown)
Line 10: Line 10:
 
<pre>echo 'sampleusername ALL=(ALL) ALL' >> /etc/sudoers</pre>
 
<pre>echo 'sampleusername ALL=(ALL) ALL' >> /etc/sudoers</pre>
 
Note that when {{command|sudo}} prompts you for a password, it expects your user password, not root's.  If you don't want to be prompted a password, use:
 
Note that when {{command|sudo}} prompts you for a password, it expects your user password, not root's.  If you don't want to be prompted a password, use:
<pre>echo sampleusername ALL=(ALL) ALL NOPASSWD:ALL' >> /etc/sudoers</pre>
+
<pre>echo 'sampleusername ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers</pre>
 
Note that above setting would allow anyone with access to your account to simply run any command including those requiring root access without any password and represents a substantial security risk.</li>
 
Note that above setting would allow anyone with access to your account to simply run any command including those requiring root access without any password and represents a substantial security risk.</li>
 
</ol>
 
</ol>

Revision as of 22:05, 22 May 2009

Fedora users should use a regular user account for regular day to day activities and a root account only for system administration. Use the personal account you created following the installation process, at first boot, for daily use. Use the root account only for administration of your system.

To run as root use the su or sudo commands. Avoid using root for any non-administration usage, since the root account makes it easy to create security or data risks. If you frequently use a single user desktop, you may find it convenient to configure sudo so you can use the same password for both root and your regular account. To do this, follow this procedure:

  1. Become the root user using the su command. Enter the password for the root account when prompted.
    su -
  2. Run this command, using your user account name in the place of "sampleusername":
    echo 'sampleusername ALL=(ALL) ALL' >> /etc/sudoers

    Note that when sudo prompts you for a password, it expects your user password, not root's. If you don't want to be prompted a password, use:

    echo 'sampleusername ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
    Note that above setting would allow anyone with access to your account to simply run any command including those requiring root access without any password and represents a substantial security risk.

Reference

http://fedorasolved.org/post-install-solutions/sudo