Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Im trying to make a shortcut to login my ssh server:

ssh x.x.x.x

I made the following file:

ssh_home.sh

Made it executable:

sudo chmod +x ./ssh_home

Checked by right clicking properties to check if it was executable and it was..

But whatever I do, when double clicking it, it will launch gedit. I tried "Open With" but no terminal app is shown there. I searched the net but only found a way to link to the file while not integrating it in one "shortcut file"

share|improve this question
1  
Did you add #! /usr/bin/sh at the beginning of the file (the first line)? –  Misery May 23 '13 at 11:50
    
Out of interest, what version of Ubuntu are you running? In principle it should be just a case of marking the file as executable in Properties/Permissions, but on 13.04 this seems not to work for me (even directly on the .sh file, with #! /bin/bash at the start...) –  Jez W May 23 '13 at 11:59
    
Also check owner and permissions. Does user clicking it have permission to run it? –  Misery May 23 '13 at 12:04
1  
Your commands can't be correct - You're referring to ssh_home.sh and /ssh_home, which are not the same files. –  l0b0 May 23 '13 at 12:04
    
I've just added what you suggested file contains now: #! /bin/bash shh x.x.x.x But still no succes.. I'm using ubuntu 13.04 64bit I'll try to make the shh_home.desktop but I rather just keep one file because I don't want to have to link to such a small file with so little code.. –  michel May 23 '13 at 14:07

3 Answers 3

up vote -6 down vote accepted

open a terminal

sh '/home/yourname/Desktop/yourfile'   

or drag and drop it...

share|improve this answer
5  
The question is to get a launcher set up on teh desktop... I dont think the terminal command would help on that front. –  charlie May 23 '13 at 12:21

I know this is a while ago but though if someone else asks I have this answer.
Open nautilus
Files menu -> behaviour tab
run executable text files when they are opened

In later versions this option is found at: Files menu -> Edit -> Preferences -> behaviour tab

share|improve this answer
    
Works perfectly, thank you. –  denysonique Oct 2 '13 at 2:57
    
This should be the accepted answer IMHO. I was getting rather frustrated trying to figure out why I could not run the shell script from Nautilus. –  David Baucum Aug 16 at 0:12

I think it would be better to use a launcher file for your script by creating a ~/Desktop/ssh_home.desktop file with the following contents:

[Desktop Entry]  
Version=1.0  
Exec=/home/yourname/bin/ssh_home.sh  
Name=SSH Server  
GenericName=SSH Server  
Comment=Connect to My Server  
Encoding=UTF-8  
Terminal=true  
Type=Application  
Categories=Application;Network;

That way you will have an icon to click which will launch your script.

share|improve this answer
    
This method IS working but I prefer a 1 file solution... –  michel May 23 '13 at 14:16
1  
@michel If all the script does is run ssh host, you don't need the script, just change the Exec line to Exec=ssh host. –  geirha May 23 '13 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.