====== Using sudo to avoid typing the root password all the time ====== When you're installing your new Linux system, you very often need to launch commands as root. The right way to do it in the console is: <code console> $ su - Password: </code> After entering the password, you'll be root. When you're done with the root commands, just type <color red>exit</color>. Now, if you just need to type ONE command as root, this is pretty boring : first, "<color red>su -</color>", then "your command", then "<color red>exit</color>". Remember, Linux is about efficiency ! So you can use the <color red>sudo</color> command to achieve that in only one step. Furthermore, you can even avoid having to enter a password (this is not a recommended setup, but this is possible). The whole process shifts from 1 minute to 5 seconds. First, login as root (this will be the last time you'll have to do it the long way!) <code console> $ su - Password: </code> After the password is entered, edit the <color green>/etc/sudoers</color> file with <color red>visudo</color>. Then, add a line at the bottom. If you want to use <color red>sudo</color> without a password for some users (we'll set which ones later), add this: <file> %wheel ALL=(ALL) NOPASSWD: ALL </file> Note that it obviously is a security issue. The users pertaining to the "wheel" group (see below), once logged, will have basically the same rights that root without entering root's password. If you want to use sudo with a password: <file> %wheel ALL=(ALL) ALL </file> Users in the "wheel" group will have to enter their own password each time they use sudo (not root's password). Note that by default, sudo remembers your authentication for several minutes, which means you won't have to enter your password each time if you're using it more than once in a row. Now, you have to add the users you trust (only yourself ? :p) to the wheel group. You can use the GUI for that, found in your window manager menu (the command is <color red>system-config-users</color>). Or, if you prefer, the command line : <code console> # usermod -a -G wheel myusername </code> You'll have to logout/login for the changes to be applied. ~~META:date created = 2006-08-28 18:34:00~~

 
blog/using_sudo_to_avoid_typing_the_root_password_all_the_time.txt · Last modified: 08/03/2010 13:25 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki