Create SSH shortcut in Linux

I got quite a few servers where I login via SSH. As a Linux user, I feel tired typing more than few things at a time (not my fault!), so I decided to create SSH shortcuts and save it to my desktop. From then, all I needed to do is open that shortcut and just type in my password of tokenID depending on the server’s I am using. So, in this guide, I will demonstrate how to create SSH shortcut in Linux.
First go to Desktop (or where-ever you want to save these shortcuts) and create a file named production.desktop.

blackmore@blackTOP:~/Desktop$ cd /home/blackmore/Desktop/
blackmore@blackTOP:~/Desktop$ 
blackmore@blackTOP:~/Desktop$ vi production.desktop 

Copy paste the following codes in the file:

[Desktop Entry]
Version=1.0
Name=My Server
Comment=Login to Prod
Exec=mate-terminal --disable-factory --sm-client-disable --class=MyServer -x ssh -t root@example.com
StartupWMClass=MyServer
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=utilities-terminal
StartupNotify=true

Create SSH shortcut in Linux - blackMORE Ops -2The most important thing you need to change is the user and server name (FQDN) i.e. root@example.com to something like andrew@10.1.1.30 or sam@myserver.com etc. Depending on your Linux distro, you might also need to change Icon=utilities-terminal as this name might not be same.

Save the file and then change the permission to the file:

blackmore@blackTOP:~/Desktop$ chmod -R +rwx production.desktop

You should see an ICON on your desktop with MyServer name.

Right click-open or double-click both would fire up a SSH session to your server with username pre-filled waiting for your password/token/security code. Pretty neat!

On a side note, if you are trying to secure your servers, then perhaps use CSF Firewall and limit it by country code as shown in here. I’ve always found CSF to be better compared to Fail2Ban.

Check Also

Identifying harmful activity on your captured traffic

This Python script utilises Wireshark or TCPdump to analyse network traffic stored in a specified …

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

Boot Ubuntu Server 22.04 LTS from USB SSD on Raspberry Pi 4

This is a guide for configuring Raspberry Pi4 to boot Ubuntu from external USB SSD …

2 comments

  1. Have you ever thought about using the ~/.ssh/config file?

  2. As Tomas mentioned, the ~/.ssh/config file is the way to go, especially if you use a lot of systems at the same time. Start up a terminal, `vim ~/.ssh/config` and add the following text:
    “`
    Host nameofserver
    User nameofuser
    Hostname ipaddressordnsname
    Port 22
    “`
    After that you can just type `ssh nameofserver` and you can log in. You can do a lot more stuff with it if you want.

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from blackMORE Ops

Subscribe now to keep reading and get access to the full archive.

Continue reading

Privacy Policy on Cookies Usage

Some services used in this site uses cookies to tailor user experience or to show ads.