DEV Community

Mahajurul Karim
Mahajurul Karim

Posted on

๐Ÿš€ How I Configured SSH Access from My Local Linux Mint to a VPS

๐Ÿš€ How I Configured SSH Access from My Local Linux Mint to a VPS

A clean DevOps-style SSH setup for secure and fast server access.


๐Ÿง  Architecture Overview (Diagram)

flowchart LR
    A[Local Linux Mint Machine] --> B[SSH Key Pair]
    B --> C[Private Key: moti-dig-1]
    B --> D[Public Key: moti-dig-1.pub]

    D --> E[VPS Server]
    E --> F[~/.ssh/authorized_keys]

    A -->|ssh moti-dig-1| E
Enter fullscreen mode Exit fullscreen mode

๐Ÿ” Step 1: Generate SSH Key (Custom Name)

Instead of default keys like id_rsa, I created a dedicated key for this server:

ssh-keygen -t ed25519 -C "moti-dig-1" -f ~/.ssh/moti-dig-1
Enter fullscreen mode Exit fullscreen mode

This creates:

  • ~/.ssh/moti-dig-1 โ†’ Private key
  • ~/.ssh/moti-dig-1.pub โ†’ Public key

๐Ÿ“ค Step 2: Copy Public Key to VPS

ssh-copy-id -i ~/.ssh/moti-dig-1.pub -p 44 root@165.22.104.176
Enter fullscreen mode Exit fullscreen mode

This installs the public key into:

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

on the VPS.


๐Ÿงช Step 3: Test SSH Connection

ssh -i ~/.ssh/moti-dig-1 -p 44 root@165.22.104.176
Enter fullscreen mode Exit fullscreen mode

Once successful, we move to automation.


โš™๏ธ Step 4: SSH Config for Clean Access

Edit SSH config:

nano ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

Add:

Host moti-dig-1
    HostName 165.22.104.176
    User root
    Port 44
    IdentityFile ~/.ssh/moti-dig-1
    StrictHostKeyChecking accept-new
Enter fullscreen mode Exit fullscreen mode

โšก Step 5: Connect with Simple Command

Now access the server with:

ssh moti-dig-1
Enter fullscreen mode Exit fullscreen mode

No IP, no port, no key flags.


๐Ÿ”’ Security & Best Practices

  • Use ed25519 keys (modern & secure)
  • Keep one key per server/project
  • Use SSH config for clean workflow
  • Set proper permissions:
chmod 600 ~/.ssh/moti-dig-1
chmod 600 ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ Final Thoughts

This setup improves:

  • Security ๐Ÿ”
  • Productivity โšก
  • Maintainability ๐Ÿงน
  • DevOps readiness โ˜๏ธ

If you manage multiple servers, this setup is a must-have for scaling your workflow like a professional DevOps engineer.

Top comments (0)