Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a script named vpn.sh.The contents is as follows:


cd /etc/openvpn

sudo openvpn client.ovpn &

when I am in konsole, ./vpn.sh runs well. But when I double click the vpn.sh file, it has no response. Can someone tell me the difference between the above two methods?

share|improve this question

migrated from stackoverflow.com Jul 21 '11 at 18:43

This question came from our site for professional and enthusiast programmers.

This belongs on Super User, it is not a programming question. – Charles Goodwin Jul 21 '11 at 4:26
Or Unix and Linux – Chris Knadler Jul 21 '11 at 4:28

I would say that using sudo works in command-line (as it allows one to type a password on the command-line), but will probably not work in a graphical environment.

In such a situation, you should use gksudo or kdesudo, depending on the desktop environment you're using -- see Graphical sudo for more informations.

share|improve this answer

It sounds like whatever you are using as a file browser is not set up to execute .sh files as shell scripts. When you are in a terminal and you type ./vpn.sh it executes the file as a shell script in the terminal. When you attempt to perform the same action by double clicking on the file your file browser is not set up to handle the script in the same way and will do nothing.

share|improve this answer

are you running it as an administrator/root when you double click it?

when you run it from console you used sudo and that signifies you are running the file as admin/root

share|improve this answer

Your Answer


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