Ubuntu, SecureCRT & Telnet links 🐧🔗

2024-02-15 · Series: None · Tags: SecureCRT, Linux, EVE-ng

SecureCRT & Ubuntu logos

SecureCRT will not open any SSH/Telnet links by default in Ubuntu 22.04. If you’ve found this writeup you have probably discovered this already. This article will hopefully save you some time and effort.

TL;DR

Explaination

The problem can be split into two parts:

  • Enabling SecureCRT to open links
  • Ensuring SecureCRT is used for opening said links

Desktop entry

Ubuntu uses desktop entries to specify how a program should be launched. These are configuration files which among other things define which icon to use, description and which arguments the program accepts.

The default configuration file/desktop entry for SecureCRT can be found under /usr/share/applications/SecureCRT.desktop and looks like this:

[Desktop Entry]
Name=SecureCRT
Comment=SecureCRT provides remote access using SSH2, SSH1, Telnet, Serial, and other protocols. 
Exec=SecureCRT
Icon=/usr/share/vandyke/data/securecrt_64.png
StartupNotify=true
Terminal=false
Type=Application
Categories=Network;

Actions=Window;

[Desktop Action Window]
Name=New Window
Exec=SecureCRT
OnlyShowIn=Unity;

The vital part here is the Exec=SecureCRT line. This doesn’t allow for launching the program with an URL argument. To remediate this you should append %U.

Default handler

Ubuntu uses mimetypes to determine which apps should be used to open various files and schemes. You can either add the mimetypes by editing ~/.config/mimeapps.list manually or by using xdg-mime.

To add it manually you should append the following under [Default Applications]

x-scheme-handler/ssh=SecureCRT.desktop
x-scheme-handler/telnet=SecureCRT.desktop

To add SecureCRT as default using xdg-mime you can do the following:

xdg-mime default SecureCRT.desktop x-scheme-handler/telnet x-scheme-handler/ssh

TL;DR

This oneliner should get you up and running:

sudo sed '/^Exec=/ s/$/ %U/' /usr/share/applications/SecureCRT.desktop && xdg-mime default SecureCRT.desktop x-scheme-handler/telnet x-scheme-handler/ssh

If this doesn’t work, read the explaination above and see if you can figure it out.
Should you get stuck, let me know and I might be able to help you.

Happy labbing! 😊


See Also

Got feedback or a question?
Feel free to contact me at hello@torbjorn.dev