Permission denied for /dev/stderr and /dev/stdout

Support for webhosts that use CentOS
Post Reply
PhilH
Posts: 1
Joined: 2007/09/20 13:32:20

Permission denied for /dev/stderr and /dev/stdout

Post by PhilH » 2007/09/20 14:29:27

I'm having a problem with bash shell scripts that are being called by PHP web pages. When a script attempts to write to /dev/stdout or /dev/stderr I get a 'Permission denied' error. When logged in as a normal user, there is no problem using stderr or stdout from a terminal. The permissions on /dev (drwxr-xr-x, obtained as root), /dev/stderr (lrwxrwxrwx), and /dev/stdout (lrwxrwxrwx) appear to be correct.

The same PHP pages and scripts running on a different Linux distribution (Ubuntu) do not give any errors.

Anyone have any ideas what is going on?

Thanks
Phil

michaelnel
Posts: 1478
Joined: 2006/05/29 16:50:11
Location: San Francisco, CA

Permission denied for /dev/stderr and /dev/stdout

Post by michaelnel » 2007/09/24 19:09:23

[quote]
PhilH wrote:
I'm having a problem with bash shell scripts that are being called by PHP web pages. When a script attempts to write to /dev/stdout or /dev/stderr I get a 'Permission denied' error. When logged in as a normal user, there is no problem using stderr or stdout from a terminal. The permissions on /dev (drwxr-xr-x, obtained as root), /dev/stderr (lrwxrwxrwx), and /dev/stdout (lrwxrwxrwx) appear to be correct.

The same PHP pages and scripts running on a different Linux distribution (Ubuntu) do not give any errors.

Anyone have any ideas what is going on?

Thanks
Phil[/quote]

Since /dev/stderr and /dev/stdout are both symbolic links, their permissions don't really matter. What matters is the permissions and ownership on whatever they point to:

[code]
/dev/stdout -> /proc/self/fd/1
ls -l /proc/self/fd/1
lrwx------ 1 root root 64 Sep 24 12:07 /proc/self/fd/1 -> /dev/pts/1
/dev/stderr -> /proc/self/fd/2
ls -l /proc/self/fd/2
lrwx------ 1 root root 64 Sep 24 12:09 /proc/self/fd/2 -> /dev/pts/1[/code]

Post Reply

Return to “CentOS 4 - Webhosting Support”