Shady Goings On

20/7/2007

Get sudo working on Fedora 7

Filed under: — ShadyCraig @ 10:35 pm
* * * ½  

A handy feature of Fedora 7 (and most Linux’s) is to be able to run a command as admin (root). In the past I’ve done this by using su but it’s not really a good idea for security reasons.
Using sudo will just run the one command as root, so it’s a lot safer, plus you give your own password - not roots. Here’s how I set it up.

Open a terminal session (look in the menu under Applications -> System Tools).
Then type:

[craig@localhost ~]$ su
Password:
[root@localhost craig]# /usr/sbin/visudo

You will now be in a vi-like editor.
Find the line like root ALL=(ALL) ALL and make a copy of that line just below it.
Substitute your user name for root.
Type [esc]:wq (that’s the escape key followed by colon then wq then enter)

You will now be back at roots command prompt, type exit to return to your own command prompt:
[root@localhost craig]# exit
[craig@localhost ~]$ whoami
craig
[craig@localhost ~]$

As you can see above, the whoami command prints the userid is use.
You can now use this to test out your newly configured sudo!

[craig@localhost ~]$ whoami
craig
[craig@localhost ~]$ sudo whoami
Password:
root
[craig@localhost ~]$

Note that the password entered is your own - not roots!

One Response to “Get sudo working on Fedora 7”

  1. Shady Goings On » If you forgot your root password on Linux… Says:

    […] worry! You can set a new one if you have sudo set up on your system. See my post about setting up sudo on your linux box if you haven’t […]

Leave a Reply

  • Categories

  • Meta

  • Listed on BlogShares
  • Valid CSS!
  • Valid XHTML 1.0!
  • Powered by WordPress