While the terminal is a familiar tool for developers, there are times when you want to manage files and directories intuitively in a GUI (Graphical User Interface) environment. Particularly when connecting to a server that is terminal-only, tasks like transferring files or understanding the structure can feel cumbersome.

This is where SFTP (SSH File Transfer Protocol) and a local GUI file explorer that supports it come in handy. It's like navigating and managing the remote server's file system just as you would with folders on your local computer!

Using GUI file explorer alongside terminal


What is SFTP?

SFTP is a way of transferring files based on the SSH (Secure Shell) protocol. As the name suggests, it provides functionality similar to FTP (File Transfer Protocol), but thanks to the strong encryption features of SSH, it allows for a much safer file transfer experience.

  • FTP vs. SFTP: FTP transmits usernames, passwords, and file contents in plain text, making it vulnerable to security issues. On the other hand, SFTP encrypts all communication through an SSH tunnel, allowing you to transmit sensitive information with peace of mind.
  • Additional functionalities beyond file transfer: Beyond simply transferring files, you can navigate the remote server's file system, create/delete directories, change file permissions, and perform various file management tasks.

The ssh command we typically use aims to connect to a remote server via the terminal and execute commands, while SFTP is specialized for file system access.


Integrating SFTP with GUI File Explorers: Managing Files without Terminal

In a Linux GUI environment, simply entering an SFTP address in the default file explorer (e.g., Nautilus for Ubuntu, Dolphin for KDE) allows you to connect to the remote server and manage files within a GUI. This powerful feature can significantly enhance your development workflow.

Connection Steps (For Linux)

  1. Open the File Explorer: Open the file explorer you use on Linux, such as Nautilus (Files) or Dolphin.

  2. Select 'Other Locations' or 'Network Browse': Usually located at the bottom of the left sidebar of the file explorer.

  3. Enter the Server Address: Type the SFTP address in the input field following this format:

    sftp://[username]@[target-host]:[port]

    • [username]: The username for the account connecting to the remote server. (If the local username and the remote server username are the same, this can be omitted.)
    • [target-host]: The IP address or domain name of the remote server.
    • [port]: The SSH port number. If using the default SSH port (22), this can be omitted.
      • Example: sftp://myuser@myremoteserver.com:2222 (when using port 2222)
      • Example: sftp://admin@192.168.1.100 (when using the default port 22)
      • Example: sftp://myremoteserver.com (when using the default username and port)
      •  
    • Enter Authentication Information: A pop-up window for authentication via SSH key or password will appear. Enter the relevant information based on how you connect to your server and click 'Connect' or 'Authenticate'.

    • When Using SSH Key: A prompt may appear asking for the password (passphrase) for the SSH key. If no passphrase was set, the id_rsa or id_ed25519 files will be automatically recognized for immediate connection.

    • When Using Password: Enter the password for server access.
  4. Connection Complete: If authentication is successful, the remote server's file system will be mounted in the local file explorer. You can now copy, move, delete files, or create new directories just like handling local disks.

  5. Save the connected server as a bookmark by right-clicking, allowing you to access the server's file system like a mounted drive on your local machine any time.

Example in Nautilus (Ubuntu):

  1. Open Nautilus.
  2. Click on + Other Location in the left sidebar.
  3. In the bottom's Connect to Server input box, enter an address like sftp://myuser@myremoteserver.com or sftp://myuser@123.45.67.89:2222, and hit the Connect button.
  4. Enter the password or the SSH key's passphrase in the authentication pop-up.
  5. If the connection is successful, the home directory of myremoteserver.com will appear in Nautilus, allowing you to explore and manage files just as you would with local folders.

Why is this method useful?

This GUI-based SFTP access greatly assists during various situations in the development process.

  1. Intuitive File Navigation and Management: It's very useful for those who are not familiar with terminal commands (ls, cd, cp, mv, rm, etc.) or prefer to visualize a complex directory structure at a glance. Files can easily be moved using drag-and-drop. The convenience of not having to meticulously type out file names and paths in the terminal is truly the best.
  2. Editing Scripts/Configuration Files: You can directly open, edit, and save configuration files or scripts on the server using your favorite GUI text editors (VS Code, Sublime Text, Atom, etc.), which is especially convenient for users who find using terminal-based editors (Vim, Nano) challenging.
  3. Checking Log Files: Opening vast log files from the server in a GUI explorer, downloading them for analysis, or quickly searching through specific parts become much easier.
  4. Managing Images and Media Files: When you need to view or preview images or media files stored on the server, the GUI environment proves to be much more efficient.
  5. Collaboration with Non-Developers: This allows non-developers, such as planners or designers, to access and manage specific resources on the server (e.g., images, PDF documents) without needing to teach them terminal commands, thanks to the GUI environment.

In Conclusion

Integrating SFTP with a GUI file explorer offers revolutionary convenience for users who are not familiar with server file management via terminal commands. Additionally, even experienced developers can sometimes find the intuitiveness of GUIs more efficient than terminals.

Open your Linux file explorer right now, input the SFTP address, and bring the remote server's files into your hands! You will discover another useful facet of SSH.

If you have any questions about this feature, feel free to ask!