First, a note from the owner of ArsGeek website. While some of these processes may be a bit time saving and knowledge is good for it’s own sake, I DO NOT recommend using these techniques often, if at all. I’ve had some requests for an article of this type and I’m happy to provide the information – it’s all available out in the great wide Internet anyway. However, running things as root means that there are no safety nets involved and should someone else gain access to your computer, they can do anything they want.
I’ve had three email requests now to right up how to execute things that normally require root privileges without having to enter a password. There are a number of ways to do this and we’re going to look at four of them.
Method #1 is to run everything from your terminal session as root. To do this, simply open a terminal session, and type:
sudo su -
Then enter your password (assuming you have sudo rights). *POOF* You are now root. You can do thinks like “apt-get install zangband” and you won’t be prompted for a password. Once you end your terminal session, your root privileges vanish. Of course, while you’re still in your session there is nothing stopping you from deleting your entire file system either, so be carefull. There’s a reason why so many people use sudo.
Method #2 involves allow root to log into your Gnome session. When you log in as root, obviously you won’t be prompted for a root/sudo password when you launch something that requires root privileges, such as changing the time, or running Synaptic. However this comes with the added danger of being able to destroy and/or mess up things without having to enter a password and thus get that final reminder that what you’re doing could effect your entire system.
To enable root to log into your Gnome session in Dapper:
Go to System -> Administration -> Login Screen Setup and then click on the Security tab, choose Security and check off the “Allow root to log into GDM” box.
To enable root to log into your Gnome session in Edgy:
Go to System -> Administration -> Login Window Preferences and click on the Security tab. Check off “Allow local system administrator login”.
Method #3 is by far the most dangerous. This will give you the ability to run sudo without a prompt for a password and without becoming root. This effectively makes you a root user. This also effectively makes anyone who happens to know or steal your username/password or hack into your account root as well. That’s a very, very bad situation to be in so again keep this in mind if you chose to make this change to your system.
To do this, you’re going to have to use visudo to edit your sudoers file:
EDITOR=gedit sudo visudo
Now you’re going to change:
USERNAME ALL=(ALL) ALL
to (or add if you don’t have it)
USERNAME ALL=(ALL) NOPASSWD: ALL
Replace USERNAME with your own.
Method #4 is much more selective. If you have a single process that you find changing all the time or a program installed in a location not owned by you that you launch all the time, you can change the owner to yourself. I use this one occasionally. If you look at my Songbird tutorial, you’ll see that I installed Songbird in my /opt directory, which is owned by root. However, I don’t want to be prompted for a password each time I launch it, so I used the chown command to give myself ownership of it. Since I own it there’s no password prompt.
Again, I advise you think about what you’re doing before you make any of these changes.