Permission denied when running Ruby script - RUBY

This is a discussion on Permission denied when running Ruby script - RUBY ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Permission denied when running Ruby script

  1. Default 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:
    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.
    --
    Posted via http://www.ruby-forum.com/.


  2. Default Re: Permission denied when running Ruby script

    [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

    On Wed, Feb 20, 2008 at 10:31 PM, Tim Conner <crofty_james@hotmail.com>
    wrote:

    > 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.
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >



  3. Default Re: Permission denied when running Ruby script


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

    > 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
    > <crofty_james@hotmail.com>
    > 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.


+ Reply to Thread