I am setting up a server in Amazon EC2. I created an image from Amazon's provided images of Ubuntu x64 12 LTS. My goal is to set up a secure svn server there, where access is only possible by IP address, SSH and certificates. I also need to migrate existing public keys from an old server.
Having played with permissions I managed to add another user account, but somehow locked myself (ubuntu
) out of the server. Remote root
log in is disabled, and I locked ubuntu
user. Ooops.
This is why I would like to create a temporary user account, say FOO
. If I lock it out, I still have ubuntu
. I would like this user to have the same privileges as ubuntu
, i.e. I want to do something like
sudo apt-get install subversion
Problem
When I created a new user and sshed to the server, the server always asked me for sudo password, when I called anything starting from sudo
Question
How to add a new user with the same privileges as ubuntu
, so I can call sudo ...
without being prompted with a sudo password?
This is what I have done so far:
# add user
sudo useradd -m -G ubuntu,adm,dialout,dip,plugdev,netdev,admin FOO
# add public key for ssh
sudo -s
cd /home/FOO
mkdir .ssh
cd .ssh
nano authorized_keys
Generate certificate in PuttyGen
Add public key to authorized_keys
#set permissions for ssh to work
chown -R FOO /home/FOO/.ssh
chgrp -R FOO /home/FOO/.ssh
chmod 0755 /home/FOO
chmod 755 /home/FOO/.ssh
chmod 644 /home/FOO/.ssh/authorized_keys
#add FOO to sudoers
sudo usermod -aG sudo FOO
##check permissions
ls -lha /home/FOO
ls -lha /home/FOO/.ssh