I want to open link like "ssh://username@hostname" with ssh.
I think xdg-open can help me(xdg-open ssh://username@hostname), but I don't know how.
How can i do it?
4 Answers
What I could gather, you have to register the protocol in the gconf:
gconftool-2 --set --type=bool /desktop/gnome/url-handlers/ssh/enabled true
gconftool-2 --set --type=string /desktop/gnome/url-handlers/ssh/command 'gnome-terminal -e "%s"'
gconftool-2 --set --type=bool /desktop/gnome/url-handlers/ssh/needs_terminal false
(source)
I can't get it to register ssh in chromium though. Haven't tried with firefox, but these instructions should help.
-
1
You can open the ssh link on the command line by using ssh username@hostname
(I think you know this already) if you want to access it via nautilus in gnome then you can minimise all windows and do [ctrl]+L which will open a dialog. Type in your url ssh://username@hostname
and click open.
This should solve most of your problems. xdg-open can only open the url if the url has been mounted somewhere already. Otherwise it can't access the ssh files.
if i understand your question correctly then i think you want to open such link in gui mode. To open such links in nautilus just replace ssh with sftp
open nautilus and type sftp://user@host in address bar and press enter
I was looking for Gnome support for ssh://
links that we use at our work on our internal websites. I ended up making my own simple script in my home directory that could handle them.
I choose to place it in ~/bin
that I created for my local scripts, but you can choose whatever you want, of course.
mkdir -p ~/bin
cat << 'EOF' > ~/bin/open-ssh-link.sh
#!/usr/bin/env bash
gnome-terminal -- ssh $1
EOF
chmod +x ~/bin/open-ssh-link.sh
Now when you click your first ssh://
link, you should be prompted to provide
a program to open this link. Here you enter the file just created at
~/bin/open-ssh-link.sh
.