SSH into the VM on port 2222
Overview
SFTP Gateway v3.x 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)
If you created an EC2 Key Pair in .ppk
format, you can use this directly in PuTTY.
Otherwise, if your EC2 Key Pair is in .pem
format, you need to use PuTTYgen
to convert it to .ppk
format. PuTTY only supports the PPK (PuTTY Private Key) format.
- 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 to show all file types. Click Open when you have selected your private key. - PuTTYgen will now convert your key to the proper filetype.
- To export 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.