LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2005, 03:57 PM   #1
nbframer
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Rep: Reputation: 0
/dev/stdout


I am using trying to write to /dev/stdout as user "esc" via a script - which produces the error msg - ** Unable to open file: /dev/stdout. Errno=13.

When I run this as su root - I can run the script without error.

Any idea why i cannot write to /dev/stdout? I have chmoded the dirs to 666.
 
Old 09-06-2005, 04:25 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Why are you trying to write to the device directly? I suggest you use "echo" for that kind of thing if you can.
 
Old 09-06-2005, 04:52 PM   #3
nbframer
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
The script calls a program that uses the /dev/stdout and stdin. I am moving from SCO Open server 5 to Linux Red Hat ES 4.0. The script runs fine in SCO - but I do not see why there is an issue with the stdout and stdin with Linux.
 
Old 09-06-2005, 05:50 PM   #4
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Hmm... It seems to me that writing to stdout device directly in is a SCO-dependent hack of some sort. Try creating a copy that uses echo instead.
 
Old 09-07-2005, 02:11 AM   #5
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Or, create a group (maybe called output or something) and change the group of /dev/stdout to this group. Then, make it group writeable, and add the user to this group. You can then use your existing code.
 
Old 09-07-2005, 10:10 AM   #6
nbframer
LQ Newbie
 
Registered: Sep 2005
Posts: 3

Original Poster
Rep: Reputation: 0
i see that on the SCO box stdout, stdin, stderr have the following attributes:

crw-rw-rw- 2 root root 24, 1 Feb 17 2001 stdout
crw-rw-rw- 2 root root 24, 0 Feb 17 2001 stdin
crw-rw-rw- 2 root root 24, 2 Feb 17 2001 stderr

but the Linux box stdout, stdin, stderr have the following attributes:

lrwxrwxrwx 1 root root 15 Sep 1 05:34 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Sep 1 05:34 stdout -> /proc/self/fd/1
lrwxrwxrwx 1 root root 15 Sep 1 05:34 stderr -> /proc/self/fd/2

could there be an issue with the type of file (character device vs. linked file)?
 
Old 09-10-2005, 04:48 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
With the linux box, stdin, stdout, and stderr have their own per-process definitions as fds. Is this program run setuid or anything alone those lines? Any user should be able to write to file descriptors they control.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot access EITHER CD drive! And there's no /dev/hdc or /dev/hdd or /dev/cdrom! Dmalic Linux - Hardware 13 11-18-2005 07:11 PM
what is stdout stefaandk Linux - Newbie 1 09-06-2005 07:20 PM
Switch stdout between /dev/null and a file? gremlin2000 Linux - General 2 06-08-2004 07:12 AM
Switch stdout between /dev/null and a file? gremlin2000 Linux - Newbie 1 06-01-2004 10:13 AM
stdout with tk? sk8guitar Programming 1 07-30-2003 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration