0

I'm running Ubuntu 11.10. I'm trying to setup a user that's essentially a clone of the permissions of the ubuntu user. This works but I'm not able to sudo with this new user without supplying a password (which I don't even have for this user). How can I set it up to work the same way as the ubuntu user?

Here's what I did (I'm doing this over SSH by the way):

I created a new user with:

sudo useradd -d /home/ryan -m ryan

Then I added this user to the admin group with:

sudo usermod -a -G admin ryan

Then I cloned the ssh keys that are setup for the ubuntu user over to this new user:

sudo mkdir /home/ryan/.ssh
sudo chown ryan:ryan /home/ryan/.ssh
sudo cp /home/ubuntu/.ssh/authorized_keys /home/ryan/.ssh
sudo chown ryan:ryan /home/ryan/.ssh/authorized_keys

I then was able to ssh to the machine as ryan using the key to authenticate me. But when I try to do a sudo commend I get prompted for a password:

ryan@machine:~$ sudo /etc/passwd
[sudo] password for ryan: 

How can I bypass this? Basically I want it to work like the ubuntu user...

1
  • What user are you running sudo with ? You need to set a password for ryan. sudo passwd ryan
    – Panther
    Feb 24, 2012 at 0:12

1 Answer 1

2

The "ubuntu" user on a live CD is configured with a blank (empty) password. Once you have installed ubuntu you will want to then configure sudo.

Please note that many people, myself included, consider making this change to be a security risk (see the rootsudo page for details)

use sudoers to make the chages

sudo visudo

Add in a line at the bottom of the file,

ryan ALL=NOPASSWD: ALL

See Ubuntu wiki rootsudo and man sudoersfor details.

As an alternate, especially over ssh, I simply open a root shell

sudo -i

Yes I still have to enter a root password, but only once. This maintains both security and convenience.

When working over ssh, you might also be interested in screen ;)

7
  • I read about the sudoers file but it looks like the admin group is already in there. So because I added the ryan user to it, it should inherit sudo permission no? The ubuntu user isn't in there either.
    – Marplesoft
    Feb 24, 2012 at 0:05
  • The 'ubuntu' user is only on the LiveCD. The 'admin' group may be in sudoers, but that only allows access to the command, not access to no-password triggering.
    – Thomas Ward
    Feb 24, 2012 at 0:06
  • The other thing is, even if I was ok to type in a password, what password do I type in? I never gave my user a password at all since I'm using key authentication. BTW - I'm using a standard image of the OS on Amazon EC2, not the LiveCD.
    – Marplesoft
    Feb 24, 2012 at 0:06
  • The password you would use is the same as your log in password. If you added ryan it should work as you wish. Odd things happen if your user is specified more then once, so you can comment out the admin group if you wish. I think the live CD uses NOPASSWD as well, but, I would have to look at it (and the casper scripts) in more detail to give you a better answer.
    – Panther
    Feb 24, 2012 at 0:08
  • Sorry, I meant I added ryan to the admin group. And since the admin group in in sudoers, I thought that would be enough. I think @Thomas pointed out the issue though.
    – Marplesoft
    Feb 24, 2012 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .