Page 6 of 6 FirstFirst ... 456
Results 51 to 57 of 57

Thread: How can I connect to SFTP using Nautilus (Files)

  1. #51
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by dragonfly41 View Post
    Re: reverse SSH tunnelling

    I have not tried this myself but as I understand the article the general idea is not to SSH from local to remote, but rather the reverse (from remote to local)
    I use reverse-SSH daily. For Paddy to do this he'd need a shell account on the remote system to initiate the connection... and he does not have that as he has said multiple times.

    Reverse-SSH is useful e.g. to create "your own VPN". Example:

    Where I work my office PC can SSH out, but the firewalls there forbid to SSH in. I am supposed to use Windows-based Citrix nonsense that most of the time does not work properly. So I wrote a systemd service for my work PC that SSH's into my system at home with a reverse tunnel.

    https://ubuntuforums.org/showthread....5#post14041285

    And so this SSH connection sits there on my server at home. And when I want to get back into my work PC I can use that reverse SSH tunnel and get back in, even though the firewalls were supposed to block this. They can't. Because the connection was initiated from my work PC on the inside and that traffic is allowed.

    The network security guys at my work place probably would not be happy if they knew about this (because I'm basically circumventing and bending their firewall rules whichever way I like...), but then again they don't strike me as being very "competent" anyway. And I'm pretty safe from any consequences. So using reverse SSH tunnels is not something I'd recommend risking if you can be fired easily from your job or if you are easy to replace. Only do this if you are like me in a BOFH position and they fear firing you more than keeping you

    But back to Paddy and his problem: NO, reverse SSH is not an option here since he does not have a shell account on the remote system and can neither SSH in and therefore not SSH out.

  2. #52
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by Paddy Landau View Post
    New information. I realised that the two sftp commands weren't identical, because I forgot to add the key. This works:
    Code:
    sftp -P [customport] -i ~/.ssh/[privatekey] [remoteuser]@[server]
    That one is identical to "sftp sg".
    Yaaay!! So ... how is that private key named at the moment? If we can get the "sftp" command line tool to pick it up automatically then Nautilus might start working too... Because the error message that you were getting about "Permission denied (publickey)" was clearly about the tool not finding the key. We have to make it load that key...

    I will check if there are more magic parameters we can put into ~/.ssh/config ... maybe there's a way to get the key loaded for exactly that connection. There should be.

  3. #53
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How can I connect to SFTP using Nautilus (Files)

    Yes!!

    Of course there is a parameter! So ... your ~/.ssh/config file should look like this:

    Code:
    Host nickname-for-your-sftp-connection
      Hostname real-server.fqdn.internet.address-or-ip
      Port 9999
      User yourusername
      IdentityFile /path/to/your/keyfile/id_rsa
    Now your command should work just like this:
    Code:
    sftp sg
    No specifying of any ports, no specifying of any key file, no error messages. Done correctly this should just work. And so should Nautilus, finally.

  4. #54
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,783
    Distro
    Lubuntu 18.04 Bionic Beaver

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by scorp123 View Post
    Now your command should work just like this:
    Code:
    sftp sg
    Yes, you might have missed a couple of my posts. To summarise:

    • "sftp sg" works perfectly.
    • FileZilla works perfectly.
    • Nautilus seems to connect with "sftp://sg", but then fails because it doesn't know what to do with "The file" (whatever "The file" might be): Could not display "sg (sftp)". The file is of an unknown type.
    • I can access other servers from the same host using the same method, but unlike "sg", they don't use virtual disks. That's one big difference. The other big difference is that I can SSH into those other servers. Only "sg" prevents SSH.

    All of that makes me think that some configuration or processing in Nautilus is incorrect, failing to understand the "sg" server's virtual disk. After all, both FileZilla and sftp understand it just fine.
    Always make regular backups of your data (and test them).
    Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.

  5. #55
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,903
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by Paddy Landau View Post
    [*]Nautilus seems to connect with "sftp://sg", but then fails because it doesn't know what to do with "The file" (whatever "The file" might be): Could not display "sg (sftp)". The file is of an unknown type.
    What if you specify the target path right away? e.g. try to access:
    Code:
    sftp://sg/path/to/where/you/are/supposed/to/go
    And not just "sftp://sg" ... does that make any difference in Nautilus?

    I'm starting to wonder if this might be some strange Nautilus issue... and maybe the earlier suggestions about trying this in e.g. Thunar were not so bad. If it's not too much of a burden: You could install a VM with Xubuntu and then try it out in there with Thunar. Just to see if Thunar when confronted with the same "~/.ssh/config" file will run into the same issue or not.

    Another thing we might try: SSHFS

    We'd let SSHFS handle the mounting of the SFTP directory. To Nautilus this would just look like a local folder.
    https://askubuntu.com/questions/8769...nstead-of-sftp
    https://furick.com/icbd/2017/08/moun...-ubuntu-linux/

    I've read on numerous pages that SSHFS uses SFTP in the background to transfer files (and not plain "SSH" as the name might suggest). So if that is true then using SSHFS might work too.

  6. #56
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,783
    Distro
    Lubuntu 18.04 Bionic Beaver

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by scorp123 View Post
    What if you specify the target path right away?
    That gives a different response.
    "This location could not be displayed. Sorry, could not display all the contents of "[path]": The connection is closed (the underlying SSH process exited)."
    So, if "the underlying SSH process exited", perhaps Nautilus is using SSH and not SFTP?
    Quote Originally Posted by scorp123 View Post
    I'm starting to wonder if this might be some strange Nautilus issue…
    I fully agree. It must be Nautilus at fault.
    Quote Originally Posted by scorp123 View Post
    … maybe the earlier suggestions about trying this in e.g. Thunar were not so bad.
    Well, I tried Thunar, and it was weird. It thought for a bit, then opened my password manager! How bizarre. There was no connection.
    Quote Originally Posted by scorp123 View Post
    If it's not too much of a burden: You could install a VM with Xubuntu and then try it out in there with Thunar. Just to see if Thunar when confronted with the same "~/.ssh/config" file will run into the same issue or not.
    I'll try that later today if I have time, and let you know.
    Quote Originally Posted by scorp123 View Post
    Another thing we might try: SSHFS
    Again, later today if I have time. I'm a bit overwhelmed at the moment.

    I'll let you know, today or tomorrow.

    Thanks again!
    Always make regular backups of your data (and test them).
    Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.

  7. #57
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,783
    Distro
    Lubuntu 18.04 Bionic Beaver

    Re: How can I connect to SFTP using Nautilus (Files)

    Quote Originally Posted by scorp123 View Post
    … install a VM with Xubuntu and then try it out in there with Thunar.
    I installed Xubuntu into a VM.

    I had the same results.

    As with Nautilus, Thunar can open the other servers fine, but with "sg", it also complains that it doesn't understand the file that it's supposed to open.

    As an experiment, I installed Nautilus, but the results were, again, identical.
    Quote Originally Posted by scorp123 View Post
    Another thing we might try: SSHFS
    I can't make sshfs work, even for the other servers that work perfectly with Nautilus, etc.


    I'm going to let this go. It's taken an awful lot of time, and I rather suspect that it's simply not going to work. I'll live with FileZilla.
    Always make regular backups of your data (and test them).
    Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.

Page 6 of 6 FirstFirst ... 456

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •