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
The 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.
Have you ever thought about using the ~/.ssh/config file?
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.