SUMMARY: ssh issue within script



After some messing around (trial and error really) i have got it to work.

Original problem is below but the resolution was to remove the -n from
the ssh_opts variable and place it only on the source side of the ssh
command.

I had tried various -t -t options as i understand this relates to pseudo
terminals but had no joy.

The following now works :-

------
ssh_opts="-o ConnectTimeout=15 \
-o BatchMode=yes \
-o StrictHostKeyChecking=no \
-o LogLevel=quiet \
"
#-n "

-----------

ssh ${ssh_opts} -n 2>> ${err_log} user@${srv} "cat ${source_file}" | ssh ${ssh_opts} ${dest_host} "cat > ${dest_dir}/${srv}.latest.tar" 2>> ${err_log}


The -n option prevents reading from standard in and allows ssh to run in
the background and not override the shell script process. This is why i
assume it is required on the first ssh and needs not to be present on
the second.

Hope this helps someone.


Original request :-
----------------------------------

Guys i'm trying to run an ssh command from within a shell script but am
getting an error.

It works fine from the shell :-

------
ssh_opts="-o ConnectTimeout=15 \
-o BatchMode=yes \
-o StrictHostKeyChecking=no \
-o LogLevel=quiet \
-n "

-----------

ssh ${ssh_opts} 2>> ${err_log} user@${srv} "cat ${source_file}" | ssh
${ssh_opts} "cat > ${dest_dir}/${srv}.latest.tar" 2>> ${err_log}


The error i'm getting in my error log is this :-


Pseudo-terminal will not be allocated because stdin is not a terminal.
-----------------------------


The reason i am doing this type of transfer is i need to get files from
one machine to another using a third as a middle man without storing the
file on the middle machine.

e.g

host B initiates an ssh to host A and cats the file through its
connection to a third host C.

Any help appreciated

Cheers
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



Relevant Pages

  • RE: sshd / ssh setup
    ... We have an Remote FreeBSD system which is located some where on the ... This method gives the maximum protection possible utilizing ssh. ... Host setup steps. ... Reboot your system to activate sshd and login as root. ...
    (freebsd-questions)
  • SSH filter transer, was Re: Soft Update - directory/file listing
    ... But SSH file transfer is painfully slow all the time. ... ## SSH 3.2 Server Configuration File ... # Note that forwardings using the name of this host will be allowed (if ...
    (freebsd-performance)
  • Re: [opensuse] Re: OpenSUSE PuTTY ?
    ... PuTTY lets you set up all kinds of special options, tied to which host ... The ssh daemon on the host machine is usually activated by default, ... As a taster to open a remote session in a new window in any konsole ... Windows users should explore Cygwin as this will allow you to run ssh ...
    (SuSE)
  • Re: Disable name canonicalization for OpenSSH GSSAPI
    ... The issue I'm having is with a new server ... I'm unable to setup the correct reverse ... When I attempt to connect to this host with SSH, ...
    (comp.protocols.kerberos)
  • Re: hacked?
    ... So I ssh'd in and did a netstat and saw what looked like an unwanted SSH connection... ... On the local host type nmap -sV localhost -p 1-65535 to see what ports respond and which apps/services. ...
    (comp.os.linux.misc)