Permission denied when running Ruby script

I think that this question might be due to me lacking some fundamental
linux knowledge but please can someone explain to me what is going on
here. I have a ruby script that I would like to call via a cron job. I
have made the necessary adjustments to crontab but i can’t get it to
work. I think that this is because the user is getting a ‘permission
denied’ message when i try and call the script directly, however, it
works when i call it with a ruby prefix:
user@server:ruby test_script.rb
=> script works
=> -bash: ./test_server.rb: Permission denied

The script starts with the shebang line: #!/usr/bin/env ruby

On my development machine, I’m using cygwin and the script works when
called either way:
user@dev:ruby test_script.rb
=> script works
=> script works

Please can someone explain why (on the server) I am getting the
permission denied message? The same user can successfully run the
script if they call it with the ruby prefix.

Missing execute permission for the user?
Do a “chmod +x” on the script, should solve your problem.



On Wed, Feb 20, 2008 at 10:31 PM, Tim C. [email protected]

On Feb 20, 2008, at 4:37 PM, Paul wrote:

to add to that,
chmod let’s you change the permissions settings on a file.
the typical change is
chmod 755 file_name
chmod +x file_name

Since, on your machine, your user acct is owner of the file, you
already have read write and execute privileges
On the server, though, this is not the same account but the file’s
settings may be the same…

if you’re using a *nix emulator like min-gw, you will still need to
pick up some *nix skills.