Login to remote Linux server with private key
Here I’m writing how to access Linux server with private key.
This is really helpful when you setup remote server first time. For example while creating new instance to the ec2 server, it will allow you to download the private key. You can access to the remote server with this private key.
Here is a simple command:
ssh email@example.com -i staging-server.pem
- ec2-user is the user of remote linux server.
- 175.341.235.409 is IP address of remote Linux server.
- staging-server.pem is our private key. We can also give the directory of this file.
While running this command, an permission issue to the private key may occur.
For this use following command:
chmod 600 staging-server.pem
If your SSH key requires a password, enter it when prompted to complete the connection.