Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to be able to run commands as root... How do i do this?

sudo yum install @kde-desktop
cromwell is not in the sudoers file. This incident will be reported.

I found a post saying to edit /etc/pam.d/gdm but there are several variants (gdm-password, gdm-pin, etc) and i dont really want to go out on a limb.

This is the first question i have, with my first time running Fedora I am very pleased that it comes with the up to date software i am looking for. Any and all help getting past this simple problem would be greatly appreciated.

How do i make the sudo command work in fedora 20? (I do not want to log in as root, simply run the commands as root)

EDIT
the following is a copy-paste from my bash prompt:

[root@localhost /]# sudo adduser cromwell sudo  
Usage: adduser [options] LOGIN  
       adduser -D  
       adduser -D [options]  

Options:  
  -b, --base-dir BASE_DIR       base directory for the home directory of the  
.............  
  -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping  

[root@localhost /]#   

EDIT 2

I tried the following command, as instructed here:

sudo usermod -aG sudo cromwell

it then says: group 'sudo' does not exist

i then enter sudo usermod -aG and press tab a few times...

output

abrt chrony ftp halt
nobody root tss adm
colord games lp openvpn rtkit unbound avahi cromwell
gdm mail operator
shutdown usbmuxd avahi-autoipd daemon
geoclue mysql polkitd sshd
bin dbus gnome-initial-setup nm-openconnect pulse sync

i then ran the following command sudo usermod -aG adm cromwell and it ran with no error... i did a full reboot, and once logged back in i ran sudo mkdir~/test`... then low and behold i get the same error about the sudoers list =(

(it may be worth noting that i did manage to install kde by logging in as root, therefore i am currently using KDE as my desktop. but still.... how do i use sudo?)

EDIT SHOULD I ADD MY USER TO THE root GROUP? (EDIT- i am told here to NOT do this, as it will result in massive security issues)

EDIT

the first option of the accepted answer was what worked. THE SECOND OPTION DID NOT. This should be noted here, or the second option deleted

=========================================
Note, if this is off topic for super user (or not within the expertise of this website) please let me know, and i will personally flag it for migration. Thank you.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Sudo's configuration file is /etc/sudoers. You can't modify this directly, even as root, so instead you must use the command visudo to pull up an editor. Of course,you'll have to have elevated privileges to run visudo, so use the su command first.

In this file, you can assign sudo permissions to users and/or groups, and do many other things besides :)

In your case, add the following line to the sudoers file, opened via visudo:

cromwell ALL=(ALL) ALL

This will enable cromwell to do anything by using the sudo command.

Fedora's default editor is vim, which can confuse users who aren't familiar with it. First, press i for Insert. The word "Insert" will appear at the bottom of the screen. Now you can make your changes. To save them, first press ESC to go back to Command Mode. Then, type :wq This Writes the file, then Quits the editor.


Other notes:

In Debian-based distributions, there is a sudo group set up by default, and this group is referenced in sudoers as %sudo ALL=(ALL) ALL. (The percentage sign a signifies a group). You could do this too, by choosing (or creating) an appropriate group, and adding it to sudoers.

Once this is done, you can simply add a user to that group. Without root access, however, you won't be able to.

So, to get root access:

su

Then, to add the user to the sudo group (for example):

adduser cromwell sudo

Then, you'll have to logout and log back in for sudo to work.

Good luck!

share|improve this answer
    
after using the above command, it provided usage documentation. I logged out and back in. It still gives the same warning when attempting to use the sudo command as the user cromwell. Are you 100% positive that this is the correct format for the command? The usage says adduser [option] login... this says it would be adduser sudo cromwell, but i dont want to add sudo to the group cromwell by misunderstanding the usage page. Thoughts? ---EDIT: Rebooting to see if it helps –  Konner Rasmussen Apr 18 at 19:38
    
no dice =( I dont get it... Other resources say to do this very same thing. I can use su to log in as root, and successfully run the following command sudo mkdir /home/cromwell/sudo-test but all adduser gives me is a usage page, and apparently doesnt do what its supposed to... –  Konner Rasmussen Apr 18 at 19:47
1  
@KonnerRasmussen I added to my answer. I hope it helps! –  bitsmack Apr 18 at 20:13
1  
@KonnerRasmussen There, I gave another update. Hopefully this works! No, you don't want to be a root member, it makes the system susceptible to errors and exploits... –  bitsmack Apr 18 at 20:42
1  
@KonnerRasmussen Excellent! Glad it's working. As far as insert and command modes, it sounds like your default text editor is vi or vim. They're powerful and old-school, and pretty arcane at times :) There are different editors, if you prefer. If you search for editor recommendations, prepare for heated discussion! Take care. –  bitsmack Apr 18 at 21:11

If you know the root/administrator details (the one used during setup) then try to configure sudo. I've used usermod before and it worked I did have the root user to do it obviously.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.