We are running RedHat Enterprise ES 5 on x86_64. We have a perl script which does, amongst other things:

  • make a directory
  • copy dot files into it
  • chown the whole thing

The target directory is an automounted directory, which actually comes off the same thing.

If we do this as a shell script, it works:

mkdir /net/host/drive/directory/new
cp /some/stuff/.??* /net/host/drive/directory/new
chown -R user:group /net/host/drive/directory/new

If we do this in a perl script, either as system() or back-ticks, we get "operation not permitted".

This script works perfectly on Solaris which is where it came from.

The script is run as root, not with any su- or setuid going on.

Anyone have any ideas what is going on?

  • Can we get this post deleted? We don't have access to the box in question any more, so testing possible solutions isn't possible. – David Mackintosh Sep 8 '09 at 18:19
  • @John no I can't, it says "too many exiting answers or upvoted/accepted answers". – David Mackintosh Oct 18 '10 at 6:13

I will go on a limb here and speculate that you probably have that filesystem mounted as NFS with root-squash. This is a security feature, because otherwise anyone with physical access to the network and read mount access to the exported file system could then, with root access on the client machine, access any file on that filesystem.

If you really want root on the client machines to have root privileges on the exported filesystem, the you should export the filesystem with the "no root squash" option.

See this example. Note that the default value of that option on your NFS server implementation might be to root-squash, so you should double check that documentation.

  • Good guess, but no -- it is exported no_root_squash. Besides, it wouldn't explain why the shell script works and the perl script doesn't. – David Mackintosh Jul 20 '09 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.