ssh, bash, and /dev/stderr: no such device


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ssh, bash, and /dev/stderr: no such device
# 1  
Old 06-10-2010
ssh, bash, and /dev/stderr: no such device

Hello,

When I run the following program:

Code:
ssh 192.168.1.4 bash -l <<EOF
> echo foo >/dev/stderr
> EOF

I get the following confusing error.

bash: line 1: /dev/stderr: No such device or address

Does anyone know why and how to fix it? I'm capturing stdout in a variable, but I still want to submit some info to the screen if possible. stdout seemed like it might fit the bill . . .
# 2  
Old 06-10-2010
ssh blocks input devices which are not terminals - openSSH 2.0 does this on my system:
Code:
> ssh 1.1.1.1 <<EOF
more>echo 'foo' > 2
more>EOF
Pseudo-terminal will not be allocated because stdin is not a terminal.

Generally, you have two choices:
1. sftp a shell script over to the remote; then ssh hostname shellscript.sh
2. ssh hostname [command line goes here ]
# 3  
Old 06-10-2010
Quote:
Originally Posted by brsett
I get the following confusing error.

bash: line 1: /dev/stderr: No such device or address

Does anyone know why and how to fix it?
It means what it says: no such file.
Code:
$ ls -l /dev/stderr
lrwxrwxrwx 1 root root 4 Jun  9 10:10 /dev/stderr -> fd/2
$ ls -l /dev/fd
lrwxrwxrwx 1 root root 13 Jun  9 10:10 /dev/fd -> /proc/self/fd
$ ls -l /proc/self/fd/2
lrwx------ 1 tyler users 64 Jun 10 15:30 /proc/self/fd/2 -> /dev/pts/0
$

It's a real file, and a symlink at that, ultimately pointing to /proc/self/fd/2. If /proc/self/fd/2 doesn't exist i.e. isn't open, naturally it can't print to it. This happens because you're feeding it a script on stdin, so it figures it doesn't have to bother giving you a full set of stdin/stdout/stderr etc. Try ssh -t, it may give you a normal stderr.

Last edited by Corona688; 06-10-2010 at 06:39 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Can't find a device under /dev

Hi all, I am trying to see /dev/hwrng but can not find it. There are /dev/random and /dev/urandom but not the hwrng. Works the same config at other os. Any idea what might be happening ? Thanks (2 Replies)
Discussion started by: t35t
2 Replies

2. HP-UX

Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16)

Hi, Unable to make tape backup, please help. /opt/ignite/bin/make_tape_recovery -a /dev/rmt/?mn -I -v -m tar -x inc_entire=vg00 * Creating local directories for configuration files and archive. ======= 04/25/16 16:28:08 IST Started /opt/ignite/bin/make_tape_recovery. (Mon... (4 Replies)
Discussion started by: anuragr
4 Replies

3. Shell Programming and Scripting

[Solved] Stdout stderr to /dev/null

Sorry for my ignorance... but... I've a script with some output redirect to /dev/null, example: fsck.ext3 -a /dev/sdb1 1>/dev/null 2>/dev/null How can I simplify this redirect ? (1 & 2) thanks (3 Replies)
Discussion started by: ionral
3 Replies

4. AIX

Error opening device: /dev/fscsi0

Hello, One one of my AIX boxes I'm having the following errror: fcstat fcs0: Port Speed (supported): 4 GBIT Error opening device: /dev/fscsi0 errno: 0000003d Has anyone encountered similar errors? Thank you! (1 Reply)
Discussion started by: aixn00b
1 Replies

5. UNIX for Advanced & Expert Users

/dev not updated on usb device removal

Hello all :-) i'm not sure if its a beginner or advanced question but i have the following problem - now for some months after building a kernel from source (2.6.36 and now 2.6.38) the /dev/sd* entries are not removed if a remove the corresponding usb disk, sd card, what ever. i'm pretty sure... (0 Replies)
Discussion started by: apfelkuchen
0 Replies

6. Hardware

/dev/ttyS0: Device or resource busy

hello to everybody I have Ubuntu Lucid 10.04 installed on my Desktop and I have a PCI serial card in my computer and it has only one serial port. Actually I want to use this serial port for the serial communication and for that I executed this command : $ setserial -g /dev/ttyS and I... (0 Replies)
Discussion started by: piyush011
0 Replies

7. UNIX and Linux Applications

/dev/ttyS2 device or resource busy

Ciao a tutti!!! il mio problema è questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (1 Reply)
Discussion started by: blianna
1 Replies

8. UNIX for Dummies Questions & Answers

redirect stderr and/or stdout to /dev/null from command line

Is it possible to redirect errors at the command line when you run the script such as bash scriptname & 2>/dev/null? (1 Reply)
Discussion started by: knc9233
1 Replies

9. Shell Programming and Scripting

redirect stderr to dev/null in bash env.

Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null? while getopts "abcd" opt do case "$opt" in i) a etc ;; r) b etc ;; f) c etc ;; v) d... (7 Replies)
Discussion started by: Sniper Pixie
7 Replies

10. Solaris

mount: /dev/dsk/c0t6d0s0 no such device

I've searched through unix.com and google for this issue I am having on one particular Sun E280R with installing netbackup software from CD. I know the cd is good because i installed the software on 4 other servers right before this one. This is the issue I am seeing. vold does not mount the CD... (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question