53

Possible Duplicate:
How do I grant sudo privileges to an existing user?

I've been searching for the answer to this but all I find is "It's not a good idea" or "We don't recommend it" and some work around solution is given...

I am a new, yes. There is a good chance I could break stuff, I know. I am happy to break my OS and format it many times if it comes to that but restrictions of ANY kind on my OS enrage me. I want to be able to break stuff if I want, then learn how I broke it and how to fix it.

I want the safety locks off.

Please tell me how to grant a user absolute authorisation.

6 Answers6

51

To give the user "foo" unlimited passwordless access to root privileges via the sudo command, edit /etc/sudoers and add the line:

foo   ALL = NOPASSWD: ALL

See sudo(8) and sudoers(5) for more information.

As was suggested elsewhere, if you know how to use vi then it's a good idea to use visudo to edit /etc/sudoers.

jdthood
  • 12,625
30

It is not you who is being restricted (as long as you can sudo or login as root on the command-line), but it is rather every single application you run that is being restricted.

If you give yourself root privileges, every application you run also gains complete power over your computer. That is the restriction, and saying you don't want any restrictions placed over you is like saying you do not want to lock your bike or your door, for it places a restriction upon yourself.

I am amazed no one as of yet has tried to offer you that insight.

ilias
  • 433
14

Being a noob, you should better use visudo instead of editting /etc/sudoers on your own, at least because:

  1. It checks that no one is using the /etc/sudoers file at the same time.
  2. When you have finished, it checks the file for making sure it's fine.
Vivas84
  • 411
14

ok, this comes from my hacker days of trying everything in the system to see what it did.

There is a file /etc/passwd that famously holds passwords (or a marker to signify shadow passwords).

In that file, you will see something like this:

root:!:0:0::/:/usr/bin/ksh
daemon:!:1:1::/etc:
bin:!:2:2::/bin:
sys:!:3:3::/usr/sys: 
adm:!:4:4::/var/adm:
uucp:!:5:5::/usr/lib/uucp: 
guest:!:100:100::/home/guest:
nobody:!:4294967294:4294967294::/:
lpd:!:9:4294967294::/:
lp:*:11:11::/var/spool/lp:/bin/false 
invscout:*:200:1::/var/adm/invscout:/usr/bin/ksh
nuucp:*:6:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucico
paul:!:201:1::/home/paul:/usr/bin/ksh
jdoe:*:202:1:John Doe:/home/jdoe:/usr/bin/ksh 

[example taken from here]

the two sections that are interest to us are the numbers in position 3 and 4. the first one is the user ID, the second is the group. Notice that in this installation (and most installations) the values for root are both 0

If you use su or sudo to edit this file, and change the numbers on your user ID to be the same as root, then you will become root. (also, you will not be able to use rmuser on your ID, as it is now considered essential to the system)

SeanC
  • 257
11

Wouldn't it be better to add the user to the correct group?

sudo usermod -a -G sudo hduser

see also this duplicate question: How do I grant sudo privileges to an existing user?

Nanne
  • 8,685
3

For anyone also wanting to liberate their system, this is the solution that worked for me:

  1. load the Terminal
  2. type: sudo passwd root
  3. input your user's password when prompted
  4. create UNIX password when prompted
  5. type: sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'
  6. reboot the system
  7. at the login screen there is now an option to login manually. login with username 'root' and the password you created at step 4

Alternatively:

  1. Throw your hard drive in the bin because it's been tainted by Ubuntu and you'll never be able to get that stink off it no matter how many times you format.
  2. Install a new hard drive
  3. Download a Puppy Linux distro from: http://puppylinux.com/