Get sudo working on Fedora 7
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!
February 28th, 2008 at 8:02 pm
[…] 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 […]