Essential SSH Features Every Developer Should Know: Practical Uses and Real-World Scenarios

For developers, SSH (Secure Shell) is more than just a command to connect to remote servers; it’s a versatile tool with features that streamline remote development, file transfers, and secure connections. In this post, I won’t dive into how SSH works or the most secure way to set it up—plenty of resources exist for that. Instead, I'll walk you through some of the SSH features I regularly use as a developer and explain how they’ve helped in real-world scenarios.

Connecting to a Server Using SSH

SSH is commonly used to connect to servers through a password or private key authentication method.

  1. Password Method: The most straightforward approach where you log in using a username and password.

     ssh username@server_ip
    
  2. Private Key Method: A more secure and commonly preferred method where you use a private key instead of a password.

ssh -i /path/to/private_key.pem username@server_ip

This method is handy when accessing servers where password authentication is disabled for security reasons.

SSH Config File for Managing Multiple Hosts

Maintaining various SSH commands can be cumbersome if you work with multiple servers. The SSH config file simplifies this by allowing you to define host configurations.

Here is a snippet from my ~/ssh/.config file

Host myserver
    HostName server_ip
    User username
    IdentityFile ~/.ssh/private_key.pem

This way, instead of typing out the entire command, I can just use:

ssh myserver

This config file is a lifesaver in larger environments, especially when combined with SSH key agents and ProxyJump.

SSH Key Agent and ProxyJump

SSH Key Agent keeps private keys in memory, saving you from entering the passphrase each time. Simply run:

ssh-add ~/.ssh/private_key.pem

For environments with a jump server (also known as a bastion host), I’ve found the ProxyJump command is immensely helpful. For example, when connecting through a bastion host:

ssh -J bastion_host target_server

In one of my real-world scenarios, I had to set up an SSH connection through a bastion host to access a target server securely. This method was handy when working remotely with VSCode's Remote SSH extension.

Copying Files Using SCP

Transferring files between local and remote servers using SCP is another common task I often face.

  • copying from local to remote

      scp /local/path/to/file username@server_ip:/remote/path
    

copying from remote to local

scp username@server_ip:/remote/path /local/path

I use SCP frequently to test Laravel jobs. For example, I copy CSV and Excel files to a server, where jobs process them as input. It’s also handy for transferring other assets like PDFs or images.

SSH Tunnels: Local, Remote, and Dynamic Port Forwarding

SSH tunnels can be a powerful way to forward ports for different tasks securely.

  1. Local Port Forwarding: This allows you to access a remote service locally by forwarding a local port to a remote server's port. I used this method to access the database of a Bitnami WordPress server that had restrictions on direct access.

     ssh -L 3306:localhost:3306 username@server_ip
    
  2. Remote Port Forwarding: This forwards a local port to a remote machine. I’ve used this to forward my local Express.js (which is deployed on AWS Lambda) to a remote Laravel server to test API integrations.

     ssh -R 4000:localhost:3000 username@server_ip
    

Dynamic Port Forwarding: This acts like a SOCKS proxy. In one project, I had to integrate a third-party API into a Laravel application, which restricted API access to our staging server’s IP. I used dynamic port forwarding with an HTTP to SOCKS proxy converter to test the API locally via Postman.

ssh -D 1080 username@staging_server_ip

Using Termius for SSH with a GUI

While the command line offers flexibility and control, tools like Termius simplify SSH management by providing a clean GUI. With Termius, you can:

  • Manage multiple SSH connections with ease.

  • Use advanced features like ProxyJump, port forwarding, and key management through a user-friendly interface.

  • Sync SSH connections across devices via cloud

  • Access servers on the go using its mobile app, which has come in handy for quick fixes or server checks when I’m not near my computer.

Conclusion

SSH is an essential tool for developers, and by leveraging its lesser-known features like ProxyJump, SCP, and port forwarding, you can drastically improve your workflow. Tools like Termius further extend SSH’s usability, making it more accessible, even on mobile.

These real-world scenarios highlight how SSH can simplify tasks like file transfers, server access, and API testing. It’s much more than just a command-line tool; it’s a crucial part of any developer’s toolbox.

0
Subscribe to my newsletter

Read articles from Mahendra Kondadasu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mahendra Kondadasu
Mahendra Kondadasu

Senior Software Engineer passionate about backend development, AWS, Linux, and automation. Sharing tech insights and hands-on projects to help others grow.