Using root in fedora 20?

2

1

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.

Konner Rasmussen

Posted 2014-04-18T18:05:46.900

Reputation: 449

Answers

3

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!

bitsmack

Posted 2014-04-18T18:05:46.900

Reputation: 582

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 – 2014-04-18T19:38:01.803

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 – 2014-04-18T19:47:18.230

1@KonnerRasmussen I added to my answer. I hope it helps! – bitsmack – 2014-04-18T20:13:08.960

i dont have a sudo group in fedora 20... so i used adm (which should have su privilages) still nothing... see the second edit on the question – Konner Rasmussen – 2014-04-18T20:20:13.203

should i add my user to the root group? – Konner Rasmussen – 2014-04-18T20:40:18.260

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 – 2014-04-18T20:42:53.590

The first option worked, thank you =) (i did have trouble figuring out the difference between insert and command mode) – Konner Rasmussen – 2014-04-18T21:04:04.023

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 – 2014-04-18T21:11:43.070

0

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.

n34_panda

Posted 2014-04-18T18:05:46.900

Reputation: 121