I wish to run a script in the root directory. The script is /opt/poky/1.6/xx
If I log in as a superuser in Ubuntu 14.04 using sudo -i
and my own password, I can see this file using ls /opt/poky/1.6/
.
When I try to run this file in user mode with sudo /opt/poky/1.6/xx
it asks me for a sudo password. I use my normal machine password and it gives the message 'command not found'
When I go back to superuser mode using sudo -i
and run the file as /opt/poky/1.6/xx
it gives the message 'Permission denied'
If I change to the directory in superuser mode using cd /opt/poky/1.6/
and then display the file using vi xx
I have no problems viewing the file.
How can I overcome the problem of 'Permission denied' or 'command not found' in superuser mode?
sudo su
(permanent root terminal) and then launch the script without sudo (because you're already root). BTW, i'm not sure you can launch your script just by typing it's name, it should bebash /opt/script
orpython /opt/script
or w/e is needed to run the script.sudo -i
which is equivalent tosudo su
. In fact, there's no point insudo su
, just usesudo -i
or simplesu
depending on your setup. As for needing a name, that depends on whether the script has a correct shebang line.ls -l /opt/poky/1.6/xx
and also tell us whatxx
is. What kind of script. Ideally, we'd like to see the script itself but at the very least, we need to know what it is.