Menu

#355 SSH Config file support in FTP plugin

None
closed-fixed
nobody
FTP (1)
5
2016-01-19
2015-11-30
lauhub
No

Under UNIX/Linux systems (including OS X), OpenSSH's ssh client has a feature that allows to define alias to a host.

Host myhost
        User someone
        Hostname somehost.domain.tld
        Port 1022
        IdentityFile ~/.ssh/my-own-rsa

This is useful since connecting to myhost just need to type:

$ ssh myhost

without having to specify port, user, id file (like ssh -i ~/.ssh/my-own-rsa -p 1022 someone@somehost.domain.tld)

With the same config, scp works too: scp myhost:/my/file /my/local/file

Would it be possible to make FTP plugin use the default config file (e.g. ~/.ssh/config) or any other file ?

This could let one use to following to connect from JEdit's FTP plugin using the following path:

sftp://myhost/home/someone/directory/file.txt

or

sftp://myhost:/home/someone/directory/file.txt

instead of having the need to specify the key file and using a path like sftp://someone@somehost.domain.tld:1022/home/someone/directory/file.txt

Discussion

  • Alan Ezust

    Alan Ezust - 2015-12-02

    After a bit of googling, I see that parsing these config files is already supported by jsch, so it should not be too hard to try a couple of standard locations for a config file.

    http://www.jcraft.com/jsch/examples/OpenSSHConfig.java.html

     
  • lauhub

    lauhub - 2015-12-02

    Well, my config file is already in a standard location (and I don't think there is any other location for SSH config file) and this does not work.

    jsch supports config file, but are you sure FTP plugin supports config file syntax ? Do you know well enough FTP plugin source code to write this ?

    I just searched inside FTP plugin source code, and there is not trace of any OpenSSHConfig.parse call. So I don't think config file is yet supported.

     
  • Alan Ezust

    Alan Ezust - 2015-12-02

    Try this version and see if it works. It should check and parse ~/.ssh/config now

    https://www.dropbox.com/s/55jlinf5cxg2z9v/FTP.jar?dl=0

     
  • lauhub

    lauhub - 2015-12-02

    Thanks,
    Just installed it, but I don't know how to enter an existing server.

    I have a NAS alias which works well from command line (ssh NAS) but does not from FTP plugin: sftp://NAS/home/lauhub

    Does not work neither from SFTP dialog using only NAS in the first textfield.

    Is there a specific syntax ?

     
  • Alan Ezust

    Alan Ezust - 2015-12-02

    It appears there is something wrong with how I call the ConnectionManager.client.getSession on line 121 of SFtpConnection.java (svn trunk). I will have to experiment more when I have some time.

     
  • lauhub

    lauhub - 2015-12-02

    OK thanks.

    What is the starting point to participate in developing JEdit and FTP plugins (doc, readme, ...) ?

     
  • Alan Ezust

    Alan Ezust - 2015-12-02
     
  • Alan Ezust

    Alan Ezust - 2015-12-03

    Well, now the GUI lets you leave out a bunch of fields like user/pw/identityfile blank.
    It assumes if all you supply is the host, then you are referring to a host in the config file.
    Try getting the latest version from svn or dropbox and see if it works for you.

     
  • Alan Ezust

    Alan Ezust - 2015-12-03
    • status: open --> closed-fixed
    • Group: -->
     
  • lauhub

    lauhub - 2016-01-19

    Hello,

    Version 1.3 did not work
    Version 1.3.1 (built from SVN) seems to make it fine: it works also with Project Viewer.

    Behaviour is a little strange since port 22 is always displayed in the address of the file, but the right port is actually used, even if it is another port than 22.

    Thanks for your work

     

    Last edit: lauhub 2016-01-19

Log in to post a comment.