Logo

dev-resources.site

for different kinds of informations.

Set Up SSH in 1 Minute Setup Like a Pro (With Some Fun Along the Way)

Published at
12/28/2024
Categories
ssh
olympicson
Author
akinsiraifedayo
Categories
2 categories in total
ssh
open
olympicson
open
Author
15 person written this
akinsiraifedayo
open
Set Up SSH in 1 Minute Setup Like a Pro (With Some Fun Along the Way)

Ah, SSH. It's like your tech BFF that lets you teleport into servers without leaving your desk. If you've ever felt like setting it up is a secret handshake only hackers know, I'm here to let you in on the club. Let's do this step-by-step, with a sprinkle of geeky fun.


Step 1: Is SSH Installed?

First things first, let's see if you've got SSH installed. Open your terminal and type:

ssh -V
Enter fullscreen mode Exit fullscreen mode

Pro tip: That's a capital V, not a lowercase v (you're welcome). If it spits out a version number, you're golden. If not, Google how to install SSH for your OS---I believe in you.


Step 2: Head to Your SSH Folder

Run this command to jump into your hidden SSH folder:

cd ~/.ssh/
Enter fullscreen mode Exit fullscreen mode

This is where all your SSH magic happens. Think of it as your secret lair.


Step 3: Generate Your SSH Key

Ready to make some keys? Run this:

ssh-keygen -C "your_email_here"
Enter fullscreen mode Exit fullscreen mode

The -C is just adding a comment, like your email, to the key. Follow the prompts, and when it asks for a name, get creative! Name it something like id_rsa_myserver or id_rsa_mycomputer. Naming things is half the fun.

When it asks for a passphrase, consider adding one. It's like giving your private key an extra layer of protection---a bit like 2FA for your SSH.


Step 4: Check Out Your New Keys

Run this:

ls
Enter fullscreen mode Exit fullscreen mode

You should see two files:

  • id_rsa_something (your private key---NEVER share this)

  • id_rsa_something.pub (your public key---this is the one you'll share with the server)


Step 5: Add the Key to SSH

To use the key you just made, run:

ssh-add id_rsa_name_you_used
Enter fullscreen mode Exit fullscreen mode

Step 6: Share the Public Key

Display the contents of your public key with:

cat id_rsa_name_you_used.pub
Enter fullscreen mode Exit fullscreen mode

Copy it (Ctrl + Shift + C for terminal users). Now hop onto the server or computer you want to connect to.


Step 7: Paste the Key on the Other Computer

On the remote computer, navigate to its SSH folder:

cd ~/.ssh/
Enter fullscreen mode Exit fullscreen mode

Then open the authorized_keys file:

vi authorized_keys
Enter fullscreen mode Exit fullscreen mode

Press i to enter insert mode, and paste the key you copied. It should all be on one line.

When you're done, hit the Escape key, type :wq, and press Enter to save and exit.


Step 8: Connect Like a Boss

Now, back on your computer, connect to the server with:

ssh username@server_or_ip_address -p PORT
Enter fullscreen mode Exit fullscreen mode

When prompted, type yes to add the server to your known hosts. And there you go---you're in! Easy, right?


Bonus Tips for Maximum Coolness

Use Aliases

Tired of typing long commands? Add an alias to your ~/.ssh/config file:

Host myserver
    HostName server_ip_or_hostname
    User username
    IdentityFile ~/.ssh/id_rsa_name_you_used
Enter fullscreen mode Exit fullscreen mode

Now, you can just type:

ssh myserver
Enter fullscreen mode Exit fullscreen mode

Keep It Secure

Never share your private key---like, ever. If you're using keys, disable password logins on the server for extra security.

Debug Like a Pro

If something goes wrong, use:

ssh -vvv username@server_ip_or_hostname
Enter fullscreen mode Exit fullscreen mode

This will give you a play-by-play of what's happening. It's like the director's cut of SSH troubleshooting.


There you have it---your quick-and-fun SSH setup guide! Now you're ready to take over (remote) servers with style. ๐ŸŽ‰

ssh Article's
30 articles in total
Favicon
How to Set Up Key-Based and Password-Based SSH for a Newly Created User on an EC2 Instance
Favicon
SSH Keys | Change the label of the public key
Favicon
่ฎฉๅฎ‰ๅ“ๆ‰‹ๆœบไธๅ†ๅƒ็ฐ๏ผšๅœจๅฎ‰ๅ“ๆ‰‹ๆœบไธŠๆญๅปบ Rust ๅผ€ๅ‘็Žฏๅขƒ
Favicon
SSH port forwarding from within code
Favicon
Mastering Ansible on macOS A Step by Step Guide
Favicon
kkTerminal โ€”โ€” A terminal for Web SSH connection
Favicon
Set Up SSH in 1 Minute Setup Like a Pro (With Some Fun Along the Way)
Favicon
How to Configure GitHub Authentication Using SSH Certificates
Favicon
Understanding SSH: Secure Shell Protocol
Favicon
Check gitlab ssh key auth
Favicon
How I Secured Port 22
Favicon
SSH port forwarding from within Raku code
Favicon
Changing an established SSH connection without disconnecting
Favicon
SSH port forwarding from within Rust code
Favicon
Configure SSH Passwordless Login from Windows to Linux
Favicon
Push to multiple GitHub accounts!
Favicon
Access to Google Cloud Virtual Machine through SSH
Favicon
Large file transfer from VPS to local machine
Favicon
Secure Your Ubuntu VPS: Restrict SSH Access to a Specific IP
Favicon
Accessing Remote Databases Without VPN Using SSH Tunnels
Favicon
Carla Simulator 1 : How to Set Up CARLA Simulator ๐ŸŽ๏ธ๐Ÿ”ฅ
Favicon
Getting Started with Oysape: Exploring Task and Pipeline
Favicon
Increase Debian based Linux VPS serverโ€™s security
Favicon
Splunk - SSH Dashboard Creation
Favicon
Debugging SSH connections: A Comprehensive Guide
Favicon
Understanding SSH Key Pairs: A Developer's Guide
Favicon
SSH Config File - Forgotten Gem
Favicon
SSH kalitini Github.com'ga qo'shish
Favicon
Using SSH to Connect Local Git to Remote Repositories
Favicon
Quickly and Easily Manage Multiple SSH and GPG Keys Across Git Repositories

Featured ones: