In many distributions a link in the form ssh:// is not configured to be opened. This is known as a handler , and some modifications are necessary.

On the one hand, the application must be registered.

xdg-mime default ~/.local/share/applications/ssh.desktop x-scheme-handler/ssh

Be careful, sometimes the above does not complete our configuration. Once we have our ssh.desktop in the directory specified above, we may need to run an xdg-settings set default-url-scheme-handler ssh ssh.desktop.

And we need to have the file ssh.desktop in the path ~/.local/share/applications/. Its content must have the following lines.

[Desktop Entry]
Name=SSH Handler
Terminal=false
NoDisplay=true
Type=Application
Exec=/usr/local/bin/ssh-handler.sh %u
Icon=utilities-terminal
StartupNotify=false
MimeType=x-scheme-handler/ssh;

And since a ssh command can be written in several ways, we need to consider most of them. For this we have the script given in the Exec line of the above file.

#!/usr/bin/env bash

parseURL(){
    [ "$1" == "-i" ] && flg_cur=1 && shift 1
    local s=${1##ssh://}
    local a=${s%%@*}
    [ "$a" == "$s" ] && a=''
    local h=${s##*@}

    local user=${a%%:*}
    local pass=${a##*:}
    [ "$pass" == "$a" ] && pass=''
    local host=${h%%:*}
    local port=${h##*:}
    port=${port%%/}
    [ "$port" == "$h" ] && port=''

    decodeURIComponent(){
      echo "$1" | sed -e 's/%\([0-9A-Fa-f][0-9A-Fa-f]\)/\\\x\1/g' | xargs -0 printf "%b";
    }

    pass=`decodeURIComponent "$pass"`

    local cmd="$host"
    [ -n "$user" ] && cmd="$user@$cmd"
    [ -n "$port" ] && cmd="$cmd -p $port"
    cmd="ssh $cmd"
    [ -n "$pass" ] && cmd="sshpass -p '$pass' $cmd"

    echo "url: $1"
    echo "cmd: $cmd"
    echo
    [ -n "$flg_cur" ] && { eval "$cmd"; return; }
    
    kitty $cmd
}

parseURL "$@"

This script must be located where indicated in the .desktop file and must be executable.

Please note: It is possible that gvfsd has ssh associated with sftp because they use the same port. In this case we must change this configuration, because otherwise the link will open with the file browser that we have installed and will try to mount that remote resource.

This configuration can be changed in the file /usr/share/gvfs/mounts/sftp.mount. And we need to comment out the SchemeAliases=ssh line.

sed -ire 's/^SchemeAliases=ssh/#\0/' /usr/share/gvfs/mounts/sftp.mount

And of course restart the gvfsd service for this change to take effect without restarting.

kill -HUP $(ps faxu | grep gvfsd$ | awk '{print $2}')