I made a shortcut for PyCharm following this instruction (created a *.desktop file; before that I launched the application via terminal by sudo sh pycharm.sh comand). However, the shortcut I made doesn't work properly - if I launch it from Dash the application will be launched but will not work and freeze. The same will happen if I launch application via terminal by sh pycharm.sh. But, if I launch the application via terminal with sudo sh pycharm.sh comand, close it and then use shortcut, everything will work smoothly.

How can I make the shortcut work properly?


Replace sudo in the .desktop file with gksudo.

This is because sudo cannot ask you the password outside the terminal, but the command needs sudo access so it freezes on the sudo step (apparently still waiting for the password).

gksudo will graphically prompt you for the password.

Update: To execute without password:

We need to set nopasswd on that script.

  1. Edit /etc/sudoers with the command sudo visudo /etc/sudoers
  2. Add the line:

    %sudo ALL=NOPASSWD: /full/path/to/script.sh

    Replacing /full/path/to/script.sh with the actual full path.

  3. Save (Ctrl+O) and quit (Ctrl+X).

Now you should be able to run it without password. Also, you can now even use sudo instead of gksudo.

  • Than you @Bharadwai_Raju, this helped! By the way, what can I do to elude entering password everytime? – user48115 Apr 4 '16 at 17:40
  • @user48115 See my update to the answer. – UniversallyUniqueID Apr 4 '16 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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