When I type the
su command in a terminal I get
su: Authentication failure
Why doesn't this work in Ubuntu? I have tried this command in another Linux distro (Parrot OS) and it does work.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Because in Ubuntu, by default, root has no password.
su means "switch user to root" and to do that you have to enter root's password, not your own. Unless you give root a password, it doesn't have one, so you can't literally log in as root.
Here's some background:
In the Unix world, there has always been a larger division between regular users and administrators, owing to the multiuser heritage of Unix. The approach taken in Unix is to grant superuser privileges only when needed. To do this, the su and sudo commands are commonly used.
Up until a few years ago, most Linux distributions relied on su for this purpose. su didn't require the configuration that sudo required, and having a root account is traditional in Unix. This introduced a problem. Users were tempted to operate as root unnecessarily. In fact, some users operated their systems as the root user exclusively, since it does away with all those annoying “permission denied” messages. This is how you reduce the security of a Linux system to that of a Windows system. Not a good idea.
When Ubuntu was introduced, its creators took a different tack. By default, Ubuntu disables logins to the root account (by failing to set a password for the account), and instead uses sudo to grant superuser privileges. The initial user account is granted full access to superuser privileges via sudo and may grant similar powers to subsequent user accounts.
You can use
su to switch user, if you know the password of the user to switch to, for example, I can
su pixie to log in as my backup user.
Normally though, you should use
sudo and your own password to authenticate, or to start a root shell, use
That is because in the other distros when installing them they usually will prompt you to set a
root password as well as a user account password. Ubuntu does not ask for the
root password during setup, only a user account password of a user that will have
sudo access leaving the
root account disabled in Ubuntu. If you want to have this enabled, set a password for the
root account that will enable the
root account allowing for the
su command to work.
sudo passwd root
Hope this helps!
su has no password. When you run that command, you're trying to log into the hidden
root account on your machine. I'm going to assume that Parrot OS either uses the
root account or sets its password to yours, because otherwise it wouldn't work.
If you want to use
su, then you can run
sudo passwd root and set the password you want to use to log in with
su. This will also enable the root user as a full account user, however, so I don't recommend it.
Instead, when you need persistent root privileges in that shell, use
sudo su. This will allow you to become root by using your own account and password.
sudo -i will have the same effect (and people will recommend you use this instead).
su (super user authentication) is not configure for security and safe administration. When you install ubuntu you gets all administration access with
sudo as 'fist user' . The 'root' privilege with
sudo . The 'guest users' [1001,1002,1003 etc] will not be able to do super user authentication with
sudo. Admin[user with 'root' privilege] need to add other 'guest user' to 'group' for superuser privileges.
You can do all
suauthentication command with
sudo in Ubuntu.
For other linux distributions system reads 'root user' as  and 'first user' as .
suauthentication gives you access to modify and delete any file or folder as root user.
You can login as superuser by
However, it is not recommended.