Sublime Forum

Editing files on server which requires 2-factor authentication


Hi there

I wanted to edit my files on a Linux server with ST3, in which case I am using vim after I logged on to the server. I’ve found the nice plug-in of SFTP, which is designed for this. However, our server is setup to required 2-factor authentication: I need to type in a time-dependent RSA passcode, and the password to log on. Given this, can I still use ST3 + SFTP?




Your specific question’s answer is: Yes.
The plugin will ask you for password when you have not set any.

You can also just test the plug-in for as long as you like.



Hi @watch

Thanks for the reply! This is encouraging, which also means I am doing something wrong. Let me outline what my configs are, and maybe you can spot the mistakes?

I am having ST3, with the plugin SFTP installed just recently. I can see the ‘SFTP/FTP’ option in the ‘File’ dropdown menu of ST3. The OS is Windows 10. I want to edit the files on the servers, using ST3 locally, so the SFTP workflow should be ‘Server’.

  1. I’ve setup a new server, named HadoopMA, which I can edit its configs from the file: ‘\Packages\User\sftp_servers\HadoopMA.json’

  2. I already have my ssh key generated to connect to the server. Per documentation of SFTP, I have created a private ssh key, with PuTTygen, using the existing private ssh key, save the new private key in .ppk format. I am also attaching the setting while saving the private ssh key here.

  3. Below are the values for each item in the json file:

    “type”: “sftp”,
    “sync_down_on_open”: true,
    “sync_same_age”: true,
    “host”: “”,
    “user”: 123456",
    //“password”: “password”,
    //“port”: “22”,
    “remote_path”: “/home//”,
    //“file_permissions”: “664”,
    //“dir_permissions”: “775”,
    //“extra_list_connections”: 0,
    “connect_timeout”: 30,
    //“keepalive”: 120,
    //“ftp_passive_mode”: true,
    //“ftp_obey_passive_host”: false,
    “ssh_key_file”: “C:/Users/123456/.ssh/id_rsa.ppk”, <-- path to the rsa key
    //“sftp_flags”: ["-F", “/path/to/ssh_config”],
    //“preserve_modification_times”: false,
    //“remote_time_offset_in_hours”: 0,
    “remote_encoding”: “utf-8”,
    Finally, as I try to browse the server, the window at the bottom of ST3 shows

    “Connecting to SFTP server “host” as “12345”… failure (Connection timeout)”

I have a feeling that I’ve done something wrong with respect to the ssh setting…




We seem to be having a similar issue, in that the SFTP plugin doesn’t prompt for passwords properly.

When I try and connect I get:

Connecting to SFTP server "" as "billy" .....................................

And it hangs forever. I’m assuming that this is because it’s waiting for input and never hits a connection timeout. If I switch to an invalid IP address, it will timeout as expected after 30 seconds.

Is there some way to get SFTP to prompt for input?



A little more progress, it seems the Sublime SFTP is waiting for the input prompt to be "Password: ".

By default, google authenticator’s libpam prompts for "Verification Code: " so sublime never picks up the correct prompt.

A very hacky workaround is to configure google authenticator to prompt with "Password: " instead.

auth      required [authtok_prompt=Password: ] 

And then sublime SFTP properly picks up the prompt and asks you for your MFA token.

This obviously only works if you don’t use regular passwords as well. It would be nice, though maybe also a bit hacky, to have sublime SFTP configurable to detect the prompt, so we could configure this on the client side instead.

I think ideally, sublime SFTP should detect when input is requested more generically, and prompt the user appropriately though.



For anyone stumbling over this thread:
You can get it to work by adding the Google Authenticator token directly to the SFTP-settings json file.

Un-Comment this line and just put your(!) current Google Authenticator token into
"password": "565557",

Please note: You have to be fast enough with entering, saving and then connecting to the server. The token times out after X seconds!

With this I was able to connect and use the SFTP-plugin.

I hope this helps!