0

Is booting into recovery console to gain root access to "sudoers" file the proper way to enable "sudo" for myself on a clean Ubuntu 14.04 LTS installation? If yes, how do I do it? If no, what is the best way?

2 Answers2

1

Most people who install Ubuntu will already have an account, with sudo privileges, set up automatically. This will be the case if you install from the official desktop installer. If you install from a text-mode installer such as a server installer, then it's achieved by setting up a user account for yourself, and leaving the root password field blank. This will make it set your account up with sudo privileges.

If you gave a root password during installation and you want to instead use sudo, then there are a few steps:

Give your account sudo access

  1. Log into the root account (eg with su)

  2. Make sure sudo is installed with apt-get install sudo

  3. Add your user to sudo with adduser username sudo where "username" is the account name to add to sudo.

  4. Log out fully from your account then log in fresh.

Remove root password

  1. First, make sure you can sudo from your account.

  2. Then disable logging in as root with sudo passwd -l root

thomasrutter
  • 36,774
0

If you're using the default user (the one created at installation) then they're already in the sudoers file, and can edit the file by running the command:

sudo visudo

This will prompt you for the default user's password, then allow you to edit the file.

Arronical
  • 19,893