4

I have a Amazon ec2 instance, and was curious on if I should change the username (the default is ubuntu) or not?

Since you need a public SSH key in order to access the server, I don't think you do, but the fact remains - should I change the username for that server?

2 Answers 2

3

Unless you have disabled user/password authentication on your server I would suggest changing it. From a security standpoint having one component of the authentication will make it easier.

Setting up SSH key authentication

User@Host:~$ ssh-keygen -t rsa -b 4096

after generating your key you would do the following:

User@Host:~$ ssh-copy-id <username>@<host>

You will then want to verify that the key is working before disabling password authentication.

User@Host:~$ ssh <username>@<host>

You should be prompted for the passphrase you established when you created the key. If you are and you connect to the server you can now disable password authentication.

modify your /etc/ssh/sshd_config by changing the following line:

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

After this you want to reload the SSH server

User@Host:~$ /etc/init.d/ssh reload
0
1

As previously mentioned, moving from 'default' is almost always a good idea, security-wise. Changing your username from ubuntu to something else may prevent unauthorized access. However, every system has a 'root' account, and with it as an example, you can provide other measures of security for your machine/users.

  1. Ensure that root login is disabled.
  2. Prevent password login for users on your machine. (This is especially important in the case where your target username is known)
  3. Install a means of banning brute-force login attempts (fail2ban is a good option)
  4. Change your server port number.
  5. Whitelists are better than Blacklists. If you can tell your SSH server which IP's are allowed to connect, you can dramatically decrease attacks. (This can be complicated and cause problems in the future, so read and be prepared if you take it this far)

You must log in to answer this question.

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