ubuntu help

Tim Chase blinux.list at thechases.com
Wed Mar 30 00:54:54 UTC 2016

> Hello how do I tell ubuntu to allow all root access?
> I will be the only one using the linux virtual machine and i want
> to give it all root privoliges
> I know the security risks but still want to do this.

Beware: long screed below, but hopefully useful regardless of how you
intend to proceed. Even if it's risky & commonly seen as dumb. (grin)

Well, there's only one root user.  You can either use "sudo" to
perform root-only actions as your local user, or you can actually
*be* root.

I believe that Ubuntu enables "sudo" by default on the primary user,
so you only have to prefix your root-requiring command with "sudo"
and enter your password.  Sudo allows you to configure either
carte-blanche disabling of all passwords for a set of users, or
disabling them for certain subset of specified commands.  Either way,
you'd want to issue

  sudo visudo

(it likely requires you to enter your password to continue).  From
this point, assuming your login name is "hank", you'd want append
a line that either looks like


or, if there are particular commands that you want to allow without a
password but want a password on anything else, you can do something

  hank ALL=NOPASSWD: /bin/mount,/bin/umount,/bin/blkid,/bin/ifconfig

This will let you issue the white-list of commands without a
password, but will require a password for any other use of "sudo".

Sudo processes the /etc/sudoers file from top-to-bottom with
subsequent items overriding previous ones, so you want it at the

If you really need to, you can issue "sudo bash" to get a bash shell
as root to issue multiple commands, then exit to return to your
non-privileged shell.

If you're unfamiliar with "sudo", you then simply use it as a prefix
for the command you want to issue as root, such as

  $ sudo mount /dev/sdb /media/sdb

Depending on how you configured it, it would prompt you for your
user's password to proceed.

Using "sudo" is pretty much the defacto way to do this on just about
every platform (except OpenBSD where they've replaced it with "doas"
in the core system, but "sudo" is still available as an add-on
package).  It provides a simple measure of protection and helps
protect you from shooting yourself in the foot without thinking.

That said, you *can* run as root.  I strongly advise against running
directly as root because, if you have to ask how to do it, you likely
lack the technical intuition and know-how to prevent yourself from
hosing the system. Again, I repeat, this is a BAD idea.

But with that small mountain of "don't do this, it's a bad idea" up
front, you can enable a password for the root user on Ubuntu (login
as root is disabled by default because it's such a decried idea).
You can do this by using "sudo passwd root" to set it.  You can then
log out and log back in as root using your newly-created password.
If you want "root" to have a different username, you can also issue
commands to change the username and their home directory.  To do
this, you have to edit the regular and shadow versions of the
password and group database:

    # vipw
    # vipw -s
    # vigr
    # vigr -s

So now that I've shown you how to implement a really bad idea, I
continue to advise that you not follow through with it.  It's
entirely too easy to hose your system, and (depending on whether your
system has a recent EFI bug fixed) you can even brick your system
making it unbootable by any rescue/restore disk.  You can still hose
yourself using sudo, but at least you have to think about it a bit


PS: don't log in as root.  Really.

More information about the Blinux-list mailing list