Avoid typing sudo on Ubuntu Linux

by on June 4, 2006 · 24 comments· LAST UPDATED November 21, 2006

in

Q. How do I disable sudo command? I prefer old way to become super-user i.e use of 'su -' command.

A. New Ubuntu Linux v6.06 (LTS) Server is here and one of the annoying feature is use sudo (which is good for Desktop systems) for each command. On a dedicated Linux server I prefer to use su to become a super user and then run command and log out.

So after installation type following commands to setup root account:
sudo passwd root
Input root password.

Now use su for rest of your work:
$ su -
Then carry out all your work.

Please note that I personally recommend using sudo, which is much more secure and better to use. But, since you asked for it I had give you all the instructions.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 24 comments… read them below or add one }

1 Anonymous June 11, 2006 at 7:20 am

I understand your question.

as root , open the file /etc/sudoers
with vi or run the command visudo

in this file are users and groups and their permissions.

comment with # at all lines without # (commonly user root and the group %admin and others)

save ! :)

Reply

2 jrm June 12, 2006 at 3:28 pm

Instead of ‘su -‘ you can use ‘sudo -s -H’ to get you root environment…

A nifty alias would be ‘alias god=”sudo -s -H”‘. Typing ‘god’ and entering you password will give you almighty powers…

Reply

3 Rene Lindsay September 24, 2008 at 2:43 pm

Isn’t there some way of turning off all these pointless security features in Linux?
It only makes Linux unreliable and frustrating to use. In fact, it makes linux LESS secure. For instance, just yesterday I tried to add a new user to my Ubuntu. After rebooting, I got a recurring “Authentication failed” which prevented me from even entering a password. In the end I had no choice but to format and reinstall Ubuntu, losing all my documents and personal files in the process.
I feel much safer using Vista now, because UAC can be turned off and Vista doesnt require a password. So, Vista and wont block me from accessing my own files or lose my data.

Reply

4 Dimi December 3, 2012 at 11:54 pm

Sudo sucks!!!

Reply

5 ActionParsnip December 4, 2012 at 11:23 am

Why?

Reply

6 Dimi December 12, 2012 at 10:54 am

Cause it just makes your life dificult and protects you from nothing. The only thing that happens is that you have to log in as root and then f*ck up everything if you want.

Reply

7 Dimi December 12, 2012 at 11:18 am

When I use a knife to cut bread I might cut myself but this doesn’t mean I will use a spoon to cut bread.
In unix to cut bread you need at least a knife (root) and a fork (admin) which is ridiculous.

Reply

8 Patrick September 25, 2008 at 12:36 pm

Hi Rene,

That you dont know howto to use the security features in linux is not the fault of linux but a lack of knowledge on your side.
If you where a little more knowledgeable you would have known howto restore your password without reinstalling the machine.
You can easily achieve this by booting from your ubuntu cd mount your harddrive and replace the password.
also you could setup key authentication to remotely login with ssh so you dont need a root password anymore.
in short dont blame Linux for your lack of knowledge.

Cheers,
Patrick

Reply

9 Dimi December 12, 2012 at 11:05 am

“also you could setup key authentication to remotely login with ssh so you dont need a root password anymore.”

Dude! For real??? You have to remote login to your own laptop for example?
The fact that you maybe have some more knowledge than Rene (which is just a simple user) doesn’t mean that you can write all kinds of c*ap demonstrating.
Who said that you have to be a sysadmin to use linux? And the same applies to unix (mac users). Why you must have always 2 users in unix systems??
This is ridiculous.

Reply

10 Rene Lindsay September 26, 2008 at 10:43 am

Thanks Partic, but I did not LOSE my password. A linux bug prevented me from even entering it. My Password is ‘PASS’. I keep it written down next to the PC in case someone needs access while I’m gone. My point is I DONT work for the CIA, so I dont need or want all this pointless security. And, I’m not some paranoid social outcast who needs to be elevated to ‘superuser’ status just to feel special. Linux security is buggy, unreliable, and risky. Isnt there some way of turning it off? I have never come accross any malware or spyware that is as disruptive as sudo.

Reply

11 Metavoid September 26, 2008 at 1:54 pm

Rene Lindsay:
Well I hate sudo too and have no need for password so I run my linux as a super user and
have enabled auto login via KDE so the box just boots directly to the desktop.
However, thinking that Vista will not just drop dead and block access to your data is frankly
too naive… My linux is an old knoppix 3.3 and have not reinstalled even I have used it alot. On the other side, I have reinstalled my Xp twice and currently my vista takes ages to boot so I might have to end its suffering.
Also, next time you get “Authentication” box, just use another shell (ctrl+alt+f1-f8) to login and fix the problem or get your data. You never need to reinstall. Thats a windows fix and luckly you have better options with linux.

Reply

12 Rene Lindsay September 27, 2008 at 7:41 pm

Thanks for the tips, Metavoid. Enabling auto login was a good start, and gets rid of the first login. Directly after that, nm-applet wants the password again. I found I could get rid of this, by using Ubuntu’s Seahorse utility to set the keyring manager’s password to blank.
Finally I would like to run permanently as root. How do you do this in Ubuntu?

Ironically, the whole reason I even tried out Ubuntu in the first place, was because I didnt like how Vista’s UAC keeps nagging for permission.

Reply

13 Metavoid September 29, 2008 at 9:45 am

Rene:
Your welcome. Glad it worked for you too.
Ohh, didnt know seahorse could do that :) thx.

>>Finally I would like to run permanently as root. How do you do this in Ubuntu?

Well, I tried many times, but installing it as root makes it blow up. The xserver hates me and it stops in shell. So my best bet is to use Autologin in and the su command to raise the permissions when needed. Then you dont have to type sudo a million times, only remember to su to the shell 1 time. Not perfect but better than sudo IMHO. The about sugestion with
‘alias god=”sudo -s -H”‘ is also ok.
Open shell, type god. :)

Hehe yeah the UAC (User Annoying Control ?) is a features that can make me cry. Luckly you can turn it off.

Well, I agree with you. Its pretty annoying that it cannot run as root when the whole linux idea is about freedom and then again, not, i guess.
Even its not wise or anything, I still want to do it.

Reply

14 LinuxAdm December 6, 2008 at 10:21 pm

sudo is LESS secure and specially in the default way configured by Ubuntu cause you’re making superusers everybody regular user belonging to the admin. Besides when you use sudo you don’t even need a superuser password you’re becoming root typing onling your password. Both sudo and su have some flaws because they run with user or group GID enabled, but at least when you use su, the root password is requiered and as soon as you do wan’t you need you exit the terminal or close de application.

By the way, if you use su -c COMMAND you can run just one task, you don’t need to open a terminal….

Reply

15 Daniel Rosenstark January 14, 2009 at 1:37 pm

I need to shut off sudo because my Ubuntu install is in a VirtualBox, not exposed to the Internet and used only by me.

Thanks for this article. What is the minus sign for?

Reply

16 Code June 18, 2009 at 9:36 pm

Daniel :

The ‘-‘ is to source the $PATH variable.
If you want to test it out.
login as a normal user in a shell and then do ‘su root’ and try to execute service command or any other command which is included in the path. You will get a ‘command not found’.
Then do a ‘su – root’ and then try to execute the same command. It works.

Reply

17 ActionParsnip June 29, 2009 at 7:13 pm

This is a ridiculous guide. If yuo use it your system is significantly easier to hack as the root is a common account on all accounts. For all who think sudo is less secure, this is very wrong. If you want a root prompt, simply run:

sudo -i

This does not involve enabling the root account and also keeps the user prefs in your home folder, if you sudo su, you become root so all settings for apps will be in /root and not your users home. Also files accessed by sudo su after using this guide will more than likely be made the owner by root, if you start messing with files in your normal users home folder you may not be able to log in without having to boot to recovery mode and chowning

This sort of guide only helps new users break their systems. Many Linux experts sat and discussed this new user model but hey I guess you guys know better.

Reply

18 Mohamed October 2, 2009 at 3:38 am

Well you can just type sudo su and put in the password and your running as root
the alias mo=’sudo -s -H’ only works after i put in the password, but after reboot it i type in “mo” it wont work I have to type the “alias mo=’sudo -s -H'” command and type my password for it to work, is there a way to have this command and password be auto inserted when the computer boots up?
for example in Dos, if you want to auto format a computer and add label you make a batch or executable that basically types in:
“echo | y format c:/q”
add this to the autoexec,bat and it should run fine, just like path = path
is there a file like the autoexec,bat in ubuntu?

Reply

19 nixCraft October 2, 2009 at 9:58 am
20 ActionParsnip October 2, 2009 at 10:01 am

If you edit ~/.bashrc you must either:
– close all terminals and rerun them
– reboot
– or run: source ~/.bahrc

to apply the alias

Reply

21 panda911 March 21, 2012 at 9:11 am

Is there a way to fully disable sudo it keeps mucking me up mid command and i dont need the server to be heavily secured

Reply

22 Dimi December 12, 2012 at 11:27 am

Unfortunately NO.

All you can do is either:
log in as root: “su root”

If user root not created then “sudo passwd root”
(and give the password for the new user root)

Or go to sudoers file –> “sudo nano /etc/sudoers”
and add your username for example “panda911″ after the last lines
—> “panda911 ALL=NOPASSWD:ALL”

without the ” ” of course.

Cheers

Reply

23 Dimi December 12, 2012 at 11:32 am

*option 3 (to prevent sudo from asking for password)

Reply

24 Pranav D November 6, 2013 at 1:29 pm

sudo -s is the biggest tragedy in Ubuntu.
It gives users full root privilege, and they make OS changes causing havoc on the OS, and system admins have to do all the work to undo the changes.
Please can anyone help to disble sudo -s

unfortunately “-s” this is only a switch, so we cannot even disable it, as we would have to disable sudo command, which would defeat the whole purpose. :(

very sad to see major security breach feature incorporated by Ubuntu. Apart from this Ubuntu is great.

Reply

Leave a Comment

Tagged as:

Previous Faq:

Next Faq: