Permission denied when running Ruby script

T

Tim Conner

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:
e.g.
user@server:ruby test_script.rb
=> script works
user@server:./test_server.rb
=> -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:
e.g.
user@dev:ruby test_script.rb
=> script works
user@dev:./test_server.rb
=> 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.
 
P

Paul

[Note: parts of this message were removed to make it a legal post.]

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

Cheers,

Paul
 
J

John Joyce

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

Cheers,

Paul

On Wed, Feb 20, 2008 at 10:31 PM, Tim Conner
<[email protected]>
wrote:

to add to that,
chmod let's you change the permissions settings on a file.
the typical change is
chmod 755 file_name
or
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top