Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

perl -e problem

by dantheman1210 (Beadle)
on May 20, 2005 at 20:59 UTC ( #459131=perlquestion: print w/replies, xml ) Need Help??

dantheman1210 has asked for the wisdom of the Perl Monks concerning the following question:

I am running solaris 8 and perl 5.005_02.
Running a simple example as root is successful:
root# perl -e 'print"Hello World\n";' Hello World root#
But running the same example from another user fails:
cnow> perl -e 'print "hello world\n";' Can't open perl script "-e": Permission denied cnow>
I have verified that my cnow user has execute permission for perl:
ls -al /usr/local/bin/perl -r-xr-xr-x 1 root other 818096 Jan 24 2002 /usr/local/bin/pe +rl*
And that both root and cnow users are running the same perl executable.
I have also verified that I can run perl as the cnow user with a simple script:
cnow> cat testPerl.pl #!/usr/local/bin/perl -w print "This is a test\n"; cnow> ./testPerl.pl This is a test cnow>
I am at a loss as to why I am getting the permission denied error.
Please help, it is sucking the life out of me!!!

Replies are listed 'Best First'.
Re: perl -e problem
by dantheman1210 (Beadle) on May 20, 2005 at 22:19 UTC
    I figured out the problem!!!!!!
    My permissions on /devices/pseudo/mm@0:null were too restrictive and ownership was not correct. Changed owner to root:sys and permissions to 666 and all is right with the world.
    Found it out by doing a man on perl and getting an error of /dev/null: can not create

    Thank you all for your help, I wouldn't have found it without your suggestions. :)
      Glad you found your solution!

      Next time, try a
          truss -f -topen perl ...
      That'll give you a good idea of what files your process is trying to open and will likely point directly at the permissions issue.

        For others' edification, truss : Solaris :: strace : Linux. See: Monitoring and Tracing Unix Processes

        An strace command to do the same thing as the above truss command would be (sorry if flags aren't portable; strace version 4.5.9): strace -f -e trace=open perl ...

        Thanks for the extremely helpful tip merzy.

Re: perl -e problem
by TheStudent (Scribe) on May 20, 2005 at 21:59 UTC

    Hmmm, I find it curious that the argument -e is what is flagged in the error message. It is almost like -e is not being recognized as a argument and being used as a program name instead.

    Perhaps trying another command line argument like -w or -l and seeing what happens.

    Lou

Re: perl -e problem
by samtregar (Abbot) on May 20, 2005 at 21:06 UTC
    What shell is cnow running? Is it the same shell as root?

    -sam

      They are both running tcsh, and I sourced the .tcshrc file to make sure.
Re: perl -e problem
by ambrus (Abbot) on May 20, 2005 at 21:18 UTC

    This error message puzzles me, and I can't really imagine any reason for it.

    Do check however, whether the minus sign in -e is a real minus sign, not just some look-alike character.

    Update You may also want to check for perl being an alias or perl-function. (In bash, you do that with the command type perl.) I recently had some bad experience with a shell function set up in /etc/profile I didn't know of.

      Ran this:
      cnow> type perl perl is /usr/local/bin/perl
      Looks like it is going to the right place.
      I am typing in the command myself, not copy and paste, so can't think of how it could be anything other than a regular minus sign.
Re: perl -e problem
by Nkuvu (Priest) on May 20, 2005 at 21:07 UTC
    How did you verify that both root and the user cnow are calling the same perl executable? I'm guessing which perl but you never know...
      Yes, ran which perl for both and ran with full path to perl as well with the same result.
Re: perl -e problem
by devnul (Monk) on May 20, 2005 at 21:35 UTC
    What happens when you type:

    /usr/local/bin/perl -e 'print "Hello world\n";'

    - dEvNuL
      Same result.
Re: perl -e problem
by devnul (Monk) on May 20, 2005 at 21:40 UTC
    ... Another thought just occurred to me. I wonder if perl -e 'sfadfdff' attempts to create a temporary file?

    ... you may want to check permissions and see if you can create temporary files as your cnow user.

    dEvNuL
      Tried this:
      cnow> touch /tmp/nothing cnow> ls -al /tmp/nothing -rw-r--r-- 1 cnow sysadmin 0 May 20 15:53 /tmp/nothing

      So I am able to create a tmp file.
        I do not think that is a sufficient test.

        I'm not sure what the solaris function is being used, mkstemp, or something like that.
        It may not even be using the /tmp directory. Perhaps /var/tmp?

        - dEvNuL

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://459131]
Approved by samtregar
Front-paged by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2022-05-23 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?