Rich Freeman on 10 Mar 2013 13:25:26 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] File ownership under Linux


On Sun, Mar 10, 2013 at 11:04 AM, Eric H. Johnson
<ejohnson@camalytics.com> wrote:
>
> The file I want to run is an executable, so if I try the fully qualified
> path, running as root on arm7:
> /usr/bin/xenomai/latency
>
> I get an error to the effect that there is no file or directory by that
> name.

Can you run other executables on that system?  Assuming this is the
case, have you checked the permissions on the path up to the
executable - all directories must at least have the execute bit set I
believe.

>
> Adding to the puzzle, there are script files in the same folder which I can
> at least launch even though they error out as soon as they reference a local
> executable.  I can successfully run 'readelf' on 'latency' and it seems to
> indicate that there are no problems, including the ability to resolve
> referenced library files, etc.

Hmm, when you run the scripts, how are you invoking them?  Are you
running source or . on the file, or calling bash with a parameter to
read the file, or are you directly running them?

Is the device mounted noexec perhaps?

>
>  My real question is, is root on the x86 the same a root on the arm7, and
> even if it were not, should I not be able to force it with chown?

Usually, yes.  I don't know if user namespaces apply to uid 0, but I
suppose that is possible.  If you're using some alternate security
model like SELinux that could also interfere.  On a typical linux
system root is root, but there are ways to make some roots more equal
than others.

The error could also be a red herring - it might not be a real file
not found error, or the file that isn't being found might not be the
executable itself.  Usually you get more specific errors in those
cases, but if you're running on some kind of unusual userspace perhaps
not (maybe ld.so isn't the typical one, etc).  I'm not sure what error
you get if the executable file format isn't supported (a.out vs ELF vs
who knows what - all kernel options).

You might try invoking the executable via strace/gdb/etc and see what
that tells you.  Or look at it with file or scanelf or something
similar.  Oh, and do all that stuff as the user that will run the file
in the same environment.

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug