Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Bash: permission denied - Script error (http://www.chiefdelphi.com/forums/showthread.php?t=38967)

Ryan M. 16-07-2005 09:24

Bash: permission denied - Script error
 
I was just setting up a simple script to sync my project files with the ones I have stored at OSC, where I run into this error:
Quote:

Bash: permission denied
This happens when I run my super-simple script of: (with the working part cut out)
Code:

#!/bin/bash
# setup a couple of variables
# call to scp using the variables abover

The part which cause's the error seems to be the simple interpreter line at the top. If I run bash manually through bash <name of my file>, it works fine. If I try to run it with just ./<name of my file>, I get the permission denied error. If I run it as root (IE, sudo ./<name of my file>), it works fine.

I did check /bin/bash just for giggles and it is executable by all. What could be causing this?

Marc P. 16-07-2005 14:23

Re: Bash: permission denied - Script error
 
Have you made the script executable by all? If not, try

Code:

chmod 777 nameofscript.sh

Matt Krass 16-07-2005 14:59

Re: Bash: permission denied - Script error
 
The command chmod is needed, but 777 is always a bad idea, that gives everyone in the system full access to do whatever they want to the file. Not good chmod +x will add execution to its existing privileges, much more desirable.

chmod +x <name_of_file>

For example, if you as root create a file that does something simple, which you shouldn't do anyway but a lot of people do, and make it chmod'ed 777, any user could edit the file, and run it with root privileges via sudo, very messy.

Ryan M. 16-07-2005 15:23

Re: Bash: permission denied - Script error
 
Hm. Well, it works now. Why does it have to be world executable? (I did have it executable for me.)

Thanks!

sciguy125 18-07-2005 11:52

Re: Bash: permission denied - Script error
 
Quote:

Originally Posted by Ryan M.
Hm. Well, it works now. Why does it have to be world executable? (I did have it executable for me.)

What where the old permissions and what are the new ones?


All times are GMT -5. The time now is 01:33.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi