Search code examples
amazon-web-servicesamazon-ec2instancesftpsublimetext

Sublime Text SFTP not connecting to ubuntu EC2 instance


I am dealing with connecting to my ubuntu EC2 instance. I am unable to connect with my instance using SFTP. My sftp-config.json file is as follows: { "type": "sftp",

"host": "ec2 ip",
"user": "ubuntu",
"remote_path": "/home/ubuntu",
"ssh_key_file": "C:/Users/example/keypair/keypair.ppk",
//"password": "password",
"port": "22",

"remote_path": "/example/path/",
"ignore_regexes": [
    "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
    "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
    "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",

//"extra_list_connections": 0,

"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"sftp_flags": ["-F", "/path/to/ssh_config"],

//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,

I am unable to understand what is the problem. I am also using a ppk file with version 2. And also I am able to successfully connect to my instance using filezilla.

SFTP is showing the following error:

Connecting to SFTP server "ec2 ip" as "ubuntu" ......................... failure (Connection timeout)

Any help will be really appreciated. Thank you

UPDATE: I HAVE ANSWERED THE QUESTION.


Solution

  • So I have figured out what to do. Instead of using a private key to connect to the server. It is better to use openSSH server and SSH. This worked for me and it is way more better than using a private key. You can see the following tutorial to install and connect to the server using SFTP.

    The Tutorial

    Some things I should mention are:

    1. Use port 22 only. No other port worked for me.
    2. Login using your instance Public IP and username as: sftp_user.
    3. Use the remote path for config-sftp.json as '/data/'.

    For more help you can always reply to this comment.