Thread: root password
View Single Post
Posts: 515 | Thanked: 266 times | Joined on Nov 2009 @ Oelsted, Denmark
#28
Originally Posted by retsaw View Post
As I said before, it is sudo asking for your user password, so you must have entered your user password, it was accepted then sudo is telling you you don't have permission to run /bin/su.

To fix this you need to edit your /etc/sudoers file, it is dangerous to edit this file manually because if you don't do it properly sudo will complain and stop working, instead it is advisable to edit this with the command visudo (which will verify any changes you make for correctness before saving the new file), unfortunately visudo defaults to using the "vi" editor which isn't the easiest for a noob (but I like it).

For the fix:
- Become root using the command "root"
- Run "visudo"
- Switch vi to insert mode by pressing "i"
- Add either "user ALL=(ALL) /bin/su" to enable that specific command with sudo or "user ALL=(ALL) ALL" to enable all commands with sudo, and add it to the top of the file.
- Switch vi back to command mode by pressing "Esc"
- Save and quit vi by typing ":wq"
Instead of messing directly in /etc/sudoers You can create a file in /etc/sudoers.d with just the settings You need...

Like this:
Code:
echo "user ALL=(ALL) /bin/su" > /etc/sudoers.d/custom-user.sudoers
or this (same but for ALL commands):
Code:
echo "user ALL=(ALL) ALL" > /etc/sudoers.d/custom-user.sudoers
or without password:
Code:
echo "user ALL= NOPASSWD: ALL" > /etc/sudoers.d/custom-user.sudoers
(Again, run 'root' before to become root)
__________________
Christian Wilken - tux-POWER.dk!
... May the Source be with You ...