4

I have a EC2 server (UBUNTU). I have a macbook and my ".pem" file is in my laptop computer. When i try to log in my server through putty in other computer, it require my ".pem" file. Do i have to store it in extra hard drive and carry it everytime? Is there any the other way to access my server in other computer no matter which OS i used?

1 Answer 1

8

Do you have to?

No

Should you?

Yes

Why Private Keys?

You can configure SSH access a number of different ways.

private/public key pair is a common (and SECURE) method for Linux servers and the default method for Ubuntu AMIs.

Where can you store your private key?

You can store your private key in a secure location (a shared disk or USB might work if you can ensure good physical security to the device...you will also want to consider encrypting the disk and/or putting a pass phrase on your private key).

You can also use multiple private keys for different devices. If one of your keys gets compromised you only need to replace that one, and the others are okay.

Alternatives

Once you gain access to your server you can configure all sorts of access (like passwords instead a of keys, which I can't discourage enough).

You can look into locking down access to SSH to certain IPs, using two factor authentication and various other things, however private/public key pairs are common place and highly recommended.

8
  • I'm sorry but i cant understand what you meam.(I'm not good at english) This is what i did. At first, i log in my aws typing below in command -->ssh -i otkey.pem [email protected] And in my server, i added my new account by 'adduser'(new account name is rightx2) and open sshd_config file, set passward_authentication 'yes'. then, restart ssh. Aug 21, 2014 at 12:50
  • i quit the Terminal and start Terminal again. I tried to log in without 'pem' key. so i type below. ssh rightx2@ ec2-54-64-31-221.ap-northeast-1.compute.amazonaws.com but error occured : ssh: connect to host ec2-54-64-31-221.ap-northeast-1.compute.amazonaws.com port 22: Connection refused Aug 21, 2014 at 12:51
  • When i typed like below, ssh -v [email protected] error occur like this : OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: /etc/ssh_config line 102: Applying options for * debug1: Connecting to ec2-54-64-31-221.ap-northeast-1.compute.amazonaws.com [54.64.31.221] port 22. debug1: connect to address 54.64.31.221 port 22: Connection refused ssh: connect to host ec2-54-64-31-221.ap-northeast-1.compute.amazonaws.com port 22: Connection refused Aug 21, 2014 at 12:52
  • 1
    Don't use passwords for ssh it's not secure Aug 21, 2014 at 13:00
  • 3
    Passwords are not intrinsically insecure on ssh, provided you use one that is long and complex enough; passwords are not exchanged in the clear so you are still logging in over a secure channel. In principle they are less secure than using keys, but the main objection is that no one is going to remember (or want to key in) a password long enough to guarantee security. Using key pairs makes it trivial to maximise security and minimise hassle.
    – ianjs
    Aug 22, 2014 at 12:22

You must log in to answer this question.

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