Files: Connect to a server with SSH

Welcome back to our mini-series of articles on the Files app, also known as Nautilus. Files is part of the GNOME desktop, which ships in the Fedora Workstation edition. Previously we covered sorting to show your recent work at the top of your folder views. In this article, we’ll discuss how this app can manage data on your other systems using Secure Shell (SSH) connections.

SSH on your other systems

Let’s assume the system you’re connecting from, where Files runs, is considered your local system, and the system to which you connect is remote. For these instructions to work, your remote system must accept SSH connections. This happens via an SSH daemon, a process that stays running in the background. The connection also requires the remote system to have an open port on which SSH runs.

If you’re going to turn SSH on, it’s important that you use strong passwords for your computer accounts. If someone can easily guess your username and password, they could get access to your sensitive data.

If you’re running Fedora Server or another non-Workstation edition of Fedora on the remote system, it’s ready to accept connections out of the box. Fedora includes the OpenSSH server and client programs by default. If you’re running Workstation on the remote system, enable remote login:

  1. Open the Sharing preferences. Either use the Settings tool in the GNOME Shell menu at the upper right, or use the Shell search by hitting the logo key or selecting Activities. Then search for or select Sharing.
  2. Turn the Remote Login option on. You’ll need to provide a password to authorize this change, since it affects system configuration.

You can also connect to a remote Mac OS system since that operating system also offers an SSH daemon. Like the Workstation, it is not running by default. In this case, run the System Preferences tool and select Sharing to turn on Remote Login.

If you’re running a different operating system, consult the documentation to learn how to turn on the SSH daemon and open the appropriate port number (usually 22).

Connecting to the remote system

Your local system needs to know the IP address of the remote system, or a name the local system can resolve to an IP address, to proceed. You can determine the IP address of the remote system through its network configuration tool, such as NetworkManager. Open the settings tool for the appropriate network interface to see the IP address.

To connect to the remote system with SSH, follow this process:

  1. Open your Files app. From the options menu, select Enter Location, or hit Ctrl+L.
  2. For location, enter ssh://<w.x.y.z> where <w.x.y.z> is the remote system’s IP address, such as: 192.168.1.5
  3. Provide your username and password on the remote system. Remember, these may not be the same as your username and password on the local system.

Selecting "Enter location" in the Files app

Now you can manage files on the remote system.

Be aware that some functions may operate differently on a remote system. For example, on some systems if you delete a file, the file is not moved to a trash bin, but immediately erased. Typically the Files app warns you when this is the case.

Also note that power functions on a remote systems may affect your connection. For instance, if the remote system is configured to sleep after a certain span of no input via keyboard and mouse, your connection may generate an error or drop. This feature works best when the remote system is always up and connected to the network.

Now you can enjoy managing your files remotely via SSH. But what about a connection to a different type of system, like Windows? This topic will be covered in a future article, so stay tuned.


Image courtesy DijutalTim – originally posted to Flickr as Orderly #3

Using Software

10 Comments

  1. Charlie FG

    Excellent article, thank you! Very straight forward compared to how I was doing it before.

    After trying it out — this probably goes without saying — but adding the

    :port

    suffix to the location bar address allowed me to specify the port to connect to, where

    port

    was the port number I was running ssh on.

  2. David

    Does this function differently than sshfs?

    • Charlie FG

      That’s what I was using before I tried this. I might be wrong but it appears to function in a similar way to — if not exactly like — sshfs. When I make a shortcut in Files, it uses

      sftp://

      as the scheme which I believe is the way sshfs works.

      It’s mounted in the file system at

      /run/user/[UID]/gvfs/sftp:host=[...]
    • Charlie FG

      Not sure if the last reply I sent got through so here is my second attempt…

      I was using sshfs before this article. I believe it works in a similar way, if not exactly like it. When I made a Files bookmark to the network mount, and hovered over it, the tooltip had the scheme set to sftp … which seems to be the protocol sshfs uses.

      When loaded in Files, the network file system is mounted in the local directory tree (on mine anyway) at this location:

      /run/user/[UID]/gvfs/sftp:host=[IP],port=[PORT]/

  3. Doug

    Awesome! Thanks for this article — did not know this!

  4. Eduardo Garbin

    Great article. Very useful on a daily basis.
    The fedora magazine is a great source of content.
    Thank you

  5. Officially, you should use the “Other Locations” menu item in the sidebar, which gives you access to the network addresses in the bottom, where you can connect to a new server, or select from the frequently connected to Servers.

    From there, you can also connect to samba servers by using the protocol: smb://w.x.y.z too. It also can connect to ftp (using the prefix ftp://) and webdav.

    • @Anass: Very astute! I have used both entries, and in the next article I planned to show the Other Locations feature. Thanks for the tip!

      • Then, I’m sorry for spoiling the next article 😀

        Thanks for your effort to show hidden features in our every-day used apps. 🙂

  6. Great article, thanks! Are we able to set the default path to connect to on the other end please? For example, /var/www on a web server, rather than /home/user which is the default..

    Thanks in advance!

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions