-6

I have just installed WebStorm on my Ubuntu Desktop 14.04. The project I am working on uses git. If I run WebStorm from Launcher I cannot do a lot of things that need root permissions (of course). I want to be able to do something easier than opening a Terminal and typing sudo wstorm and then entering my password.

I tried creating a .sh file, but I don't know how to (1) bypass my password and (2) make it available from Launcher. Could anyone help me with this?

6
  • What do you mean with "do a lot of things that need root permissions"
    – A.B.
    Aug 23, 2015 at 15:19
  • For example, working with git. But why does it matter? I want to run it as root without entering the password every time and nothing more.
    – Victor
    Aug 23, 2015 at 15:21
  • 1
    Why should git need root permissions?
    – A.B.
    Aug 23, 2015 at 15:23
  • 1
    And the same for WebStorm? Why root?
    – A.B.
    Aug 23, 2015 at 15:25
  • 2
    git does not need root permissions unless you cloned something with sudo.
    – Pilot6
    Aug 23, 2015 at 15:37

1 Answer 1

2

Create a new script file (replace create_dir.sh with your desired script name):

vim ~/create_dir.sh

The script will be created in the user’s home directory

Add some commands that only a root or sudo user can execute like creating a folder at the root directory level:

mkdir /abc

Note: Don’t add sudo to these commands. Save and exit (using :wq!)

Assign execute permissions to it using:

sudo chmod u+x create_dir.sh

Make changes so that this script doesn’t require a password.

  • Open the sudoers file:

    sudo visudo -f /etc/sudoers
    
  • Add the following line at the end:

    ahmad ALL=(root) NOPASSWD: /home/ahmad/create_dir.sh
    

    Replace ahmad with whatever your username is. Also make sure this is the last line. Save and exit.

    Now when running the command add sudo before it like:

    sudo ./create_dir.sh
    

    This will run the commands inside the script file without asking for a password.

This is not mine reference here

3
  • The problem with this is that disabling the sudo password is a big security risk. Sure it won't ask for a password for the app, but it also won't ask for a password for say sudo rm -R / Aug 23, 2015 at 15:34
  • @Zacharee1 who disables sudo for, eg, rm?
    – A.B.
    Aug 23, 2015 at 16:35
  • @A.B. what do you mean? Aug 23, 2015 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .