Configuring an AWS Ubuntu Server Instance

Configuring the Server After connecting to your newly instantiated server, you will want to configure it. The first thing I always do is create an account for myself, and then disable the public/private key authentication requirements for SSH tunneling. Be wary about whether you choose to do this as well, RSA authentication is a far superior security measure to username/password combinations. I however do not have any sensative information on my servers, I use many different computers and creating key/value pairs for all of them is a pain, and lastly my passwords are strong.

To create a new user you will need the adduser command.

sudo adduser username

After the above command, enter the relevant information and continue. To ensure that username has been added to the list of users you can examine the last line of the /etc/passwd file.

tail /etc/passwd

Next, you should add your new user to the super user group, sudo. The usermod command with the -a and -G flags will get the job done.

sudo usermod -a -G sudo username

Here -G says to add the user, username, to the group, sudo, and the -a flag ensures the group is appended to the list of groups the user currently belongs to. This ensures any previous groups are not over written.

Once I’ve got my new account made, I’d like to be able to log in to the server simply by specifying my username and password. The can be taken care of by changing the ssh daemon running on the server. Edit three lines in the /etc/ssh/sshd_config file…

RSAAuthentication yes –> RSAAuthentication no
PubkeyAuthentication yes –> PubkeyAuthentication no
PasswordAuthentication no –> PasswordAuthentication yes

Then you will just need to restart the ssh daemon.

sudo service ssh restart

Now you can log into your server with the usual approach…

ssh username@127.0.0.1

When you don’t yet have a domain name set aside for your server you will always need to reference it by its IP address. This is uncool. To make life easier I add an entry to the /etc/hosts file on my local machines.

127.0.0.1 superServer.net

Adding the above line to the /etc/hosts file will allow you to access your server located at 127.0.0.1 with the alias superServer.net via ssh, web browsers, and more. i.e.

ssh username@superServer.net

This makes things easier when setting up virtual hosts on the instance’s apache web server.

Lastly you want to get your ubuntu verion up to snuff with all the latest security patches and updates. Run a final update/upgrade to get that underway

sudo apt-get update && sudo apt-get upgrade

In most cases you’ll be doing development, coding, and networking. You are going to need to install some software from Ubuntu’s repository to get working. Below are a few packages that I recommend for general use.

sudo apt-get install build-essential git cmake

This entry was posted in Coding. Bookmark the permalink.

One Response to Configuring an AWS Ubuntu Server Instance

  1. Pingback: Launching an AWS Instance | mathnathan

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>