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?
41 Answer
The error "Permission Denied" often means that you do not have execute permission on the file. To fix that, run chmod +x <filename> as the root user. Now, the root user can run the file using ./<filename>.
Command Not Found can mean many different things. First off, you need to have the ./ or an absolute path for running files not in your $PATH variable. (i.e../test.sh or /home/user/bin/test.sh).
However, Command Not Found can also mean that a library is missing. Check that you have all the required dependancies to run that file.