SSH into the VM
Overview
SFTP Gateway v3.0 uses port 2222
for the SSH protocol,
since the Java SFTP service is bound to port 22
.
When you connect over SSH, you need to override the default port.
Connect over Port 2222
Use the following command to SSH into the EC2 instance:
ssh -i private.key ec2-user@<ip-address> -p 2222
Note: You will be prompted to accept the server host key on first connection. The server host key is cached on your client machine, based the hostname and port.
The default SSH port is 22
, so you need to explicitly set port 2222
which is the port OpenSSH listens to.
SCP
When using SCP (which uses SSH behind the scenes), you will also need to specify port 2222
:
scp -P 2222 local-file.tar.gz ec2-user@<ip-address>:/home/ec2-user/
PuTTY (Windows)
PuTTY does not natively support the PEM format that AWS uses, so you need to first convert your .PEM file to a PuTTY
Private Key file (.PPK
). To do this, you use the PuTTYgen utility packaged with PuTTY.
- Open PuTTYgen and click Load to browse for your .PEM key. When browsing for the key, be sure to select All Files in the dropdown menu. Click Open when you have selected your key.
- PuTTYgen will now convert your key to the proper filetype.
- To save your new PPK key, click Save private key.
You are now ready to SSH in to the server with PuTTY using the new .PPK key.
- Open PuTTY and select SSH as the connection type.
- In the Host Name field, enter
ec2-user@<public ip>
- In the Port field, change
22
to2222
- Expand the SSH section on the left, and click on Auth.
- Click on Browse to browse for the .PPK key, and click Open when you have selected it.
- To launch the SSH session, click Open.