How do I get root access from shell? When I'm trying to use su
I get:
default@default-laptop:~/home/default$ su
Password:
su: Authentication error
default@default-laptop:~/home/default$
su wants the root password, if you're running Ubuntu that will be scrambled. Try sudo -s -H
or sudo su -
and give your user password.
On Ubuntu, an easier way is to use the following command:
$ sudo -s
This tells sudo to launch a shell. Make sure that you are in the admin group on Ubuntu. You can check your groups by using:
$ groups
If you are not in the group, you can add yourself by using the following
$ sudo gpasswd -a <username> admin
Also to note, on a default Ubuntu install, root's password will be the same password as the default user.
On non-Ubuntu systems, you will need to ensure that your username is part of the "wheel" group in the /etc/group file. See "man group" for syntax, etc.
On a default Ubuntu installation you cannot su as root. You can use sudo to launch any command you need.
You can also do
sudo passwd
after entering your password you will be able to give root a password. After you will be able to su as root.
su requires the root password
sudo su will accomplish the same thing, with your own password (not root's) - but you have to be set up properly in advance to do this.
Some distro's like Ubuntu give the first user full sudo access. Others, like Debian, require you to set up the root account during the install.