Permission Denied - BSD

This is a discussion on Permission Denied - BSD ; Am having vexing problem with FORTRAN compiled executable. Here is the message i get when i try to run the code: ">:/randnum$ ./rndtest_single bash: ./rndtest_single: Permission denied" This command syntax used to run fine under OpenBSD 2.6, and it also ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Permission Denied

  1. Permission Denied


    Am having vexing problem with FORTRAN compiled executable. Here is the
    message i get when i try to run the code:
    ">:/randnum$ ./rndtest_single
    bash: ./rndtest_single: Permission denied"

    This command syntax used to run fine under OpenBSD 2.6, and it also runs
    under Vector Linux 5.9 (after compiling of course).

    The env shows the path as follows:
    PATH=.:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/home/contrex/bin:/usr/libexec:/usr/local/libexec:/usr/games:/usr/local/emul/redhat/lib/:

    Is there a problem with the path? If not, what do i need to look at
    next? I am quite baffled.

    --
    Regards / JCH

  2. Re: Permission Denied

    On Sun, 09 Nov 2008 19:48:53 -0800, contrex wrote:

    > Am having vexing problem with FORTRAN compiled executable. Here is the
    > message i get when i try to run the code:
    > ">:/randnum$ ./rndtest_single
    > bash: ./rndtest_single: Permission denied"


    Is the file actually executable?

    ls -l ./rndtest_single


  3. Re: Permission Denied

    Dave Uhring wrote:
    > On Sun, 09 Nov 2008 19:48:53 -0800, contrex wrote:
    >
    >> Am having vexing problem with FORTRAN compiled executable. Here is
    >> the message i get when i try to run the code:
    >> ">:/randnum$ ./rndtest_single
    >> bash: ./rndtest_single: Permission denied"

    >
    > Is the file actually executable?
    >
    > ls -l ./rndtest_single

    _____
    Yes, see below. This is the vexing part!

    :/randnum$ ls -l rndtest_single
    -rwxr-xr-x 1 contrex contrex 6052 Nov 9 19:09 rndtest_single

    I must be doing something wrong, but where? As i said, same syntax on
    OBSD 2.6 and VL 5.9 linux runs perfectly. When i use the sh shell i get
    the same message:
    \u@\h:/\W$ ./rndtest_single
    sh: ./rndtest_single: Permission denied



    / JCH

  4. Re: Permission Denied

    Dave Uhring wrote:
    > On Sun, 09 Nov 2008 19:48:53 -0800, contrex wrote:
    >
    >> Am having vexing problem with FORTRAN compiled executable. Here is the
    >> message i get when i try to run the code:
    >> ">:/randnum$ ./rndtest_single
    >> bash: ./rndtest_single: Permission denied"

    >
    > Is the file actually executable?
    >
    > ls -l ./rndtest_single
    >

    Here is the piece of my .bashrc file that sets the path and exports it.
    Perhaps i have an error in it?

    if [ "$USER" = root ]; then

    PATH=.:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/libexec:/usr/local/libexec:/usr/local/emul/redhat/lib/:
    # PS1="\s-\v\$ "
    PS1="\u@\h:/\W\$ "
    # echo "================================================== ==" >>
    /tmp/bash.log
    # date >> /tmp/bash.log
    # echo "~/.bashrc invoked by user $USER" >> /tmp/bash.log
    export PATH PS1 CVSROOT PKG_PATH
    # env >> /tmp/bash.log
    else

    PATH=.:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/libexec:/usr/local/libexec:/usr/local/emul/redhat/lib/:
    # PS1="\s-\v\$ "
    PS1="\u@\h:/\W\$ "
    # echo "================================================== ==" >>
    /tmp/bash.log
    # date >> /tmp/bash.log
    # echo "~/.bashrc invoked by user $USER" >> /tmp/bash.log
    export PATH PS1 CVSROOT PKG_PATH
    # env >> /tmp/bash.log
    fi

    / jch

  5. Re: Permission Denied

    In article ,
    wrote:
    >
    >Am having vexing problem with FORTRAN compiled executable. Here is the
    >message i get when i try to run the code:
    >">:/randnum$ ./rndtest_single
    >bash: ./rndtest_single: Permission denied"
    >
    >This command syntax used to run fine under OpenBSD 2.6, and it also runs
    >under Vector Linux 5.9 (after compiling of course).


    Where does your executable come from ?

    If it's an old one and you're running a more recent OpenBSD, WAKE UP.
    We switched from a.out to ELF almost a decade ago. There's still some
    compat.aout mechanism somewhere in the sysctl.

    Anyways, you're not giving nearly enough information for anyone to actually
    help you. How do you get your executable ? what does file have to say about
    it ?

  6. Re: Permission Denied

    On Sun, 09 Nov 2008 21:01:34 -0800, jch wrote:
    > Dave Uhring wrote:
    >> On Sun, 09 Nov 2008 19:48:53 -0800, contrex wrote:


    >>> bash: ./rndtest_single: Permission denied"

    >>
    >> Is the file actually executable?
    >>
    >> ls -l ./rndtest_single

    > _____
    > Yes, see below. This is the vexing part!
    >
    > :/randnum$ ls -l rndtest_single
    > -rwxr-xr-x 1 contrex contrex 6052 Nov 9 19:09 rndtest_single


    Have you placed some privileged instructions in the program? Can root
    execute the program?


  7. Re: Permission Denied

    Marc Espie wrote:

    >> Am having vexing problem with FORTRAN compiled executable. Here is the
    >> message i get when i try to run the code:
    >> ">:/randnum$ ./rndtest_single
    >> bash: ./rndtest_single: Permission denied"
    >>
    >> This command syntax used to run fine under OpenBSD 2.6, and it also runs
    >> under Vector Linux 5.9 (after compiling of course).

    >
    > Where does your executable come from ?

    _____
    It is a compiled FORTRAN source to generate N random floating point
    numbers between 0 and 1. I am currently running OpenBSD v3.9 on i586.

    Here is the sh script (Forcl.sh) i use to compile the source(s):
    ------------------------------------------------------------
    #!/bin/sh
    #
    #set -x

    prog=`basename $0`
    narg=1

    # Check argument count
    # --------------------
    if [ $# -lt $narg ] ; then
    echo "$prog: you must supply at least $narg argument(s)"
    echo "usage: $prog FORTRAN_SOURCE_FILE"
    exit 1
    fi

    source_file=$1
    exe_file=`echo $source_file | sed -e 's/\..*//'`
    echo $source_file
    echo $exe_file
    #echo Executing '"'g77 -Wall -O -v -o $exe_file $source_file'"'
    echo Executing '"'g77 -Wall -O -o $exe_file $source_file'"'
    echo
    #g77 -Wall -O -v -o $exe_file $source_file
    g77 -Wall -O -o $exe_file $source_file
    strip $exe_file
    ------------------------------------------------------------

    This is the output of the Forcl.sh run:
    ------------------------------------------------------------
    >/randnum$ Forcl.sh rndtest_single.f

    rndtest_single.f
    rndtest_single
    Executing "g77 -Wall -O -o rndtest_single rndtest_single.f"

    /usr/lib/libg2c.so.8.1: warning: strcpy() is almost always misused,
    please use strlcpy()
    /usr/lib/libg2c.so.8.1: warning: sprintf() is often misused, please use
    snprintf()
    /usr/lib/libg2c.so.8.1: warning: strcat() is almost always misused,
    please use strlcat()
    ------------------------------------------------------------

    > If it's an old one and you're running a more recent OpenBSD, WAKE UP.
    > We switched from a.out to ELF almost a decade ago. There's still some
    > compat.aout mechanism somewhere in the sysctl.

    _____
    Yes, i am aware of that. Hence, i always recompile the source when
    starting some development work.

    > Anyways, you're not giving nearly enough information for anyone to
    > actually help you.

    _____
    Hopefully the above tells you more. I probably have an error in the
    compile statement somewhere? :
    g77 -Wall -O -o $exe_file $source_file

    What does file have to say about it ?
    _____
    >/randnum$ file rndtest_single

    rndtest_single: ELF 32-bit LSB executable, Intel 80386, version 1, for
    OpenBSD, dynamically linked (uses shared libs), stripped

    There is no difference when i use f77 instead of g77. Both are
    available on my system:
    >/randnum$ which g77 f77

    /usr/bin/g77
    /usr/bin/f77

    / John


  8. Re: Permission Denied

    In article , jch wrote:
    >Marc Espie wrote:
    >
    >>> Am having vexing problem with FORTRAN compiled executable. Here is the
    >>> message i get when i try to run the code:
    >>> ">:/randnum$ ./rndtest_single
    >>> bash: ./rndtest_single: Permission denied"
    >>>
    >>> This command syntax used to run fine under OpenBSD 2.6, and it also runs
    >>> under Vector Linux 5.9 (after compiling of course).

    >>
    >> Where does your executable come from ?

    >_____
    >It is a compiled FORTRAN source to generate N random floating point
    >numbers between 0 and 1. I am currently running OpenBSD v3.9 on i586.


    I have no clue, it looks like a really weird thing to me.

    Still, OpenBSD 3.9 is ancient. Unless you have very good reasons not to,
    I would advise you to update to 4.4, maybe the problem will go away. If it
    does not, I'm willing to look at it.

    Have you tried running it under the system shell ? might be an issue with
    your bash ?

  9. Re: Permission Denied

    contrex@cnx4.contrex-consulting.ca wrote:
    >
    > Am having vexing problem with FORTRAN compiled executable. Here is the
    > message i get when i try to run the code:
    > ">:/randnum$ ./rndtest_single
    > bash: ./rndtest_single: Permission denied"
    >
    > This command syntax used to run fine under OpenBSD 2.6, and it also runs
    > under Vector Linux 5.9 (after compiling of course).
    >
    > The env shows the path as follows:
    > PATH=.:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:\

    /usr/local/sbin:/home/contrex/bin:/usr/libexec:/usr/local/libexec:\
    /usr/games:/usr/local/emul/redhat/lib/:
    [Line wrapped for convenience - Joachim]
    >
    > Is there a problem with the path? If not, what do i need to look at
    > next? I am quite baffled.


    There are many things that could go wrong, but one of the more-likely
    and less-obvious is a filesystem mounted noexec.

    And no, aside from '.' being in your PATH (which may lead to executing
    the wrong binary by mistake, something you should avoid!), there is
    nothing wrong there. It doesn't need to end in :, though.

    Others have also suggested interesting possibilities, but apparently
    these do not solve your issue...

    Joachim

  10. Re: Permission Denied

    Joachim Schipper wrote:
    > contrex@cnx4.contrex-consulting.ca wrote:
    >> Am having vexing problem with FORTRAN compiled executable. Here is the
    >> message i get when i try to run the code:
    >> ">:/randnum$ ./rndtest_single
    >> bash: ./rndtest_single: Permission denied"
    >>
    >> This command syntax used to run fine under OpenBSD 2.6, and it also runs
    >> under Vector Linux 5.9 (after compiling of course).


    > There are many things that could go wrong, but one of the more-likely
    > and less-obvious is a file system mounted noexec.

    _____
    As i suspected, there is always a simple answer, and Joachim put his
    finger on it. The sources reside on an NFS connected file server which
    was indeed mounted ...,noexec,.... !! The old OBSD 2.6 computer never
    had NFS shares, and the Vector Linux 5.9 is mounted "exec", and that is
    why the executable code ran as expected.

    Thanks a million. I just don't recall why the /etc/fstab file had the
    shares mounted "noexec".

    > And no, aside from '.' being in your PATH (which may lead to executing
    > the wrong binary by mistake, something you should avoid!), there is
    > nothing wrong there. It doesn't need to end in :, though.

    _____
    Thanks for this info too. I removed the leading . , and the trailing :
    from the path statements in my .bashrc file.

    / John

  11. Re: Permission Denied

    Marc Espie wrote:
    >
    > Still, OpenBSD 3.9 is ancient. Unless you have very good reasons not to,
    > I would advise you to update to 4.4, maybe the problem will go away.

    _____
    Can do. For the solution to my problem see my note to Joachim. The NFS
    share with the source(s) was set to "noexec". After making a copy to
    /tmp, i was able to show that the compiled code ran as expected. Then i
    edited the /etc/fstab file to remove the "no" from the "exec" option.

    The OBSD Team keeps pumping out all these great upgrades. I tend to run
    a particular version for quite a while. Still have never been
    successful doing an upgrade without problems. Perhaps going from the
    3.9 to the 4.4 release is easy now? I usually build from scratch, and
    complement with various packages manually.

    I have been using OBSD for past ten years and experienced extraordinary
    stability. My office runs a firewall, file server, work station, and
    web server, all based on OBSD. Just rock solid all around. My prime
    work station remains an OBSD box, and fvwm2 is still my preferred window
    manager.

    Keep up the superb work on this excellent OS.

    / John

+ Reply to Thread