views:

322

answers:

3

I'm using an open source Perl package named "webmin" on several servers. It's mostly Perl on the inside.

I found a weird behavior on a new 64-bit server: files were getting created empty.

I've traced it down to a "Permission Denied" error in Perl's builtin function open which is pretty unusual, since the application is running as root. I had perl output the $< and $> variables, and they both claim I'm user 0

This bug seems to affect files in directories where the directory is not world executable (chmod o-x $DIR) ... and it only happens deep inside of webmin, I can't reproduce it on its own.

Does this sound even remotely familiar to anyone?

+2  A: 

ACLs on the directory?

SELinux turned on?

The fact that you're getting a "permission denied" error on a directory that doesn't have the execute bit is not surprising - on directories, the execute bit controls accessing the contents of the directory - the question is why the execute bit isn't set.

Check if any umask setting is applying to the process.

Andrew Medico
no acls on the directory. not SELinux.I should only be affected by the *user* execute bit, if I'm the directory owner (I am). And this works just fine on a 32 bit server
jes5199
+2  A: 

I've traced it down to a "Permission Denied" error [....] [w]hich is pretty unusual, since the application is running as root.

Are you sure you're running as root at the time of the failed open()?

webmin's documentation boasts the ability to exec arbitrary commands as other users, and a quick grep of the source code shows a number of instances of a function named switch_to_unix_user()...

pilcrow
I had perl output the $< and $> variables, and they both claim I'm user 0
jes5199
@jes5199, ah, now that is worth editing your original post to clarify...
pilcrow
+1  A: 

in Unix permissions, you need execute permission on a directory to access anything inside it (you don't need read permission, that's for listing the directory; you only need execute permission to access the contents). so something is accessing the file under a user that is considered "other", and it doesn't have permission

newacct

related questions