2

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?

2
  • 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. Commented Sep 8, 2009 at 18:19
  • @John no I can't, it says "too many exiting answers or upvoted/accepted answers". Commented Oct 18, 2010 at 6:13

1 Answer 1

3

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.

1
  • 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. Commented Jul 20, 2009 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .