Avoid typing sudo on Ubuntu Linux

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.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

25 comments… add one
  • Code Jun 18, 2009 @ 21:36

    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.

  • ActionParsnip Jun 29, 2009 @ 19:13

    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.

  • Mohamed Oct 2, 2009 @ 3:38

    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?

  • ActionParsnip Oct 2, 2009 @ 10:01

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

    to apply the alias

  • panda911 Mar 21, 2012 @ 9:11

    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

    • Dimi Dec 12, 2012 @ 11:27

      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.


      • Dimi Dec 12, 2012 @ 11:32

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

  • Pranav D Nov 6, 2013 @ 13:29

    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.

  • Blue Pilgrim Oct 24, 2015 @ 16:47

    I’m 68 and spent years as a programmer, and have used CP/M, Unix, DOS, BOS, OS/2, MVS, and various Windows and micro systems — not exactly a ‘newby’. But all I want now is a usable OS to get things done without having to hack into my system and become a guru in it (again).

    I got a new machine a year ago (Lenova Thinkserver) and still haven’t been able to get it up and working for anything real. I first installed Mint and wasn’t able to find even the programs, or back the system up (denied access). I am not worried about the cat hacking the machine. No backup; no security. If I can’t keep a complete backup of the system then when the disk crashes or the motherboard fails, it’s lost — with all the software, drivers, configurations, directories, etc. Gone.

    I put Debian Gnome live CD up yesterday and looked at a youtube video, and by the time it was done I found Linux had hijacked the machine, lock the screen and me out, and I had to cut the power to stop it from screaming at me in Arabic from the next video Youtube had automatically loaded. Locked me out of my machine — that’s not an OS — that’s malware.

    So far, after a year, all the different distros of Linux are unusable, won’t handle the sound, won’t shut down, won’t give me access to various partitions (and the install programs refuse to keep the partitions I had set up).

    I’m about ready to give up, and since Windows is garbage (and won’t let itself be backed up) that means just give up trying to use the computer — which I paid for, but operating systems think belongs to them. The age of the personal computer for a single user is over, and the user has lost control of his machine.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.