I am sure that this is a very basic question but I'm afraid that I have been unable to get it to work or understand what is going on.
I have a node project that I usually run with
sudo npm start
and I am trying to create a bash script that will launch this for me.
I have tried a few variations:
su myname -c "npm run start"
sudo su myname -c "npm run start"
su myname -c "sudo npm start"
but they all seem to execute the command without superuser rights. From the research that I have done it seems that
sudo su myname -c "npm run start"
is the correct one but it doesn't work (it runs but without permissions). Can someone please point me in the right direction?
sudo npm start
? Why do you think you need anything else? – Byte Commander Dec 28 '17 at 17:56npm start
asroot
or asmyname
? (To confuse you even more: there's alsosudo -u myname npm start
;-)) – PerlDuck Dec 28 '17 at 17:56