Configuring Sudo

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
m
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Fedora users should use a regular user account for regular day to day activities and a root account for administration. Use the personal account you created during installation (at First Boot) for daily use and root only for administration of your system. To run as 'root' use su or sudo commands. It is highly recommended that you do not use root for non-administration usage. For a single user desktop, configuring sudo so that you can use the same password for both root and your regular account is very convenient. This guide will help you configure sudo to do that:
+
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.
  
As root user, do
+
To run as root use the {{command|su}} or {{command|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 {{command|sudo}} so you can use the same password to access root as you use for your regular account.  To do this, select to be added to the Administration group during installation.  To do it later, or to add a different user, follow this procedure:
  
<pre>
+
<ol>
 +
<li>Become the root user using the {{command|su}} command. Enter the password for the root account when prompted.
 +
<pre>su -</pre></li>
  
echo 'sampleusername ALL=(ALL) ALL' >> /etc/sudoers
+
<li>Run this command, using your user account name in the place of "sampleusername":
  
</pre>
+
<pre>usermod sampleusername -a -G wheel</pre>
  
Where 'sampleusername' is your user account. For example, if your user account is "foobar", you can run
+
You must now log off and back on in order to have access to the wheel group. Note that when {{command|sudo}} prompts you for a password, it expects your user password, not root's.</li>
 
+
</ol>
<pre>
+
 
+
# echo foobar ALL=(ALL) ALL' >> /etc/sudoers
+
 
+
</pre>
+
 
+
Note that if you are prompted for a password with 'sudo' it is the user password, not root.
+
 
+
If you don't want to be prompted a password, use
+
 
+
<pre>
+
 
+
# echo sampleusername ALL=(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.
+
  
 
== Reference ==
 
== Reference ==
  
 
http://fedorasolved.org/post-install-solutions/sudo
 
http://fedorasolved.org/post-install-solutions/sudo

Latest revision as of 12:29, 22 March 2013

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 to access root as you use for your regular account. To do this, select to be added to the Administration group during installation. To do it later, or to add a different user, 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":
    usermod sampleusername -a -G wheel
    You must now log off and back on in order to have access to the wheel group. Note that when sudo prompts you for a password, it expects your user password, not root's.

[edit] Reference

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