2

Using Ubuntu 14.04, I have 2 accounts:

  • Account A (first one set up) with Password 1
  • Account B (second set up) with Password 2, when updating software in Account B, I use Password 1 to authenticate. Has been successful so far.

How do I set up sudo with its own Password, and then run sudo apt-get clean?

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493

1 Answers1

3

If I understand you correctly, you would like to set up a universal password that all users would have to input in order to execute a command as root with a sudo command.

Example:

  • Account-A = Password-1
  • Account-B = Password-2
  • root = root-password

If Account-A or Account-B enters the command:

sudo apt-get autoclean

Then the subsequent output:

[sudo] password for root:

would be the same for both users.

This is typically NOT the preferred method of security through the use of sudo as implemented by Ubuntu.

This is not the recommended method of password implementation

For security reasons, Ubuntu does not enable a root user account. Unlike Debian, Ubuntu disables the root account.

You have been Warned this is not recommended!

Here's how it's done:

First, open a terminal and type the following command to set up a root password:

sudo passwd root

You will be prompted for your user-password to execute sudo. You will then be prompted to choose a password for root. You will then be prompted to re-enter the newly chosen password for root.

Next, change the default editor to nano instead of vi with this command:

sudo select-editor

You will be asked to choose an editor. Type the number that corresponds to "/bin/nano" and press enter.

Then, execute the following command to edit your sudoers file. You must use the visudo command to edit the /etc/sudoers file. Do NOT edit this file using gedit, do NOT use vi, DON'T use nano or leafpad or any other text editor because you risk locking yourself out of the sudo command completely for all users if there is a synatax error. Using visudo will fix syntax errors or alert you without saving the changes.

sudo visudo

Scroll down to the first line that begins with the word "Defaults" and press enter. Move up to the newly created blank line and insert the following line:

Defaults        rootpw

Use the tab key between the two words and do not use spaces!!

Press ctrl + o to write out the changes to the file. When asked to save the file as "/etc/sudoers.tmp", delete ".tmp" and press enter to save the file as "/etc/sudoers" instead.

You will now be prompted for the root password whenever any user executes a command with sudo.

Refrences:

wiki.archlinux.org/index.php/sudo

how-do-i-make-sudo-ask-for-the-root-password

set-sudo-password-differently-from-login-one

Debian documents "sudo_configuration"

help.ubuntu.com/community/Sudoers

wiki.debian.org/sudo

mchid
  • 42,315
  • 7
  • 94
  • 147
  • Also, I found the answer to this post quite helpful http://unix.stackexchange.com/questions/68669/how-to-add-self-to-sudoers-list – mchid Aug 18 '14 at 04:19