DEV Community

Cover image for The Beginner’s Guide to Secure Shell
Fahad Hossain
Fahad Hossain

Posted on

The Beginner’s Guide to Secure Shell

It’s a secure protocol used to safely connect to remote systems over a network (typically used by developers to access servers, manage files, or interact with platforms like GitHub)

How SSH works (shortly)
Think of SSH like a secure tunnel between your computer and another system. Instead of sending your username/password every time, SSH uses key for authentication.

Generate an SSH key pair

  • Private Key: Stored secretly on computer
  • Public Key: Shared with platform server

Remote Platform need public key

  • It stores it securely in that remote account

When try to connect to remote via SSH

  • Remote asks: Do you have the matching private key?
  • My computer proves it without sending the private key
  • if it matches remote lets you in — no password needed

Generate SSH Key (Each command will worked perfectly for linux/macOS based terminal)

ssh-keygen -t ed25519 -C "email here"
Enter fullscreen mode Exit fullscreen mode

Start the SSH agent

eval "$(ssh-agent -s)"
Enter fullscreen mode Exit fullscreen mode

Add private key to SSH Agent

ssh-add ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode

Print SSH key

cat ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub (see public key)
Enter fullscreen mode Exit fullscreen mode

Delete the compromised SSH key (If needed)

rm -f ~/.ssh/id_ed25519*
Enter fullscreen mode Exit fullscreen mode

Conclusion
SSH is an essential tool for anyone working with remote systems—whether you're a developer, system administrator, or DevOps engineer. By understanding how SSH works and adopting best practices like using key-based authentication and managing your configurations securely, you can greatly enhance the safety and efficiency of your workflow. Mastering SSH not only improves your command-line skills but also empowers you to manage servers and services with confidence. So start exploring, stay secure, and take full control of your remote environments.

Top comments (1)

Collapse
 
mehedi_hasantarek_32415e profile image
Mehedi Hasan Tarek

Helpful thank you