[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh and many command line



On Tue, 12 Aug 2003 13:51:32 +0200
Elie De Brauwer <elie.de.brauwer@pandora.be> wrote:

> >  [1] ssh root@myhost "cat /etc/passwd | awk -F ':' '{ print $1; }'"
> >
> >      ONLY prints empty lines
> >
> >
> >
> >  [2]     ssh root@$ip "(  \
> >            uname -a; \
> > 	   echo '<hr>'; \
> >            fdisk -l; \
> > 	   echo '<hr>'; \
> >            ps auwxf; \
> > 	   echo '<hr>'; \
> >            find /users -type f \
> > 	   echo '<hr>'; \
> > 	   cat /etc/passwd; \
> > 	   for name in `cat /etc/passwd | awk -F : '{ print $1}'`; do echo
> > '<b>'$name'<b><ul>';crontab -u name -l; echo '</ul>'; done; \ echo '<hr>';
> > \
> >          )"
> >
> >
> > the for name in ... command is executed by the local machine and not the
> > remote one ???
> >
> >
> >
> > 	Any help is welcome :-)
> >
> > 		François
> 


Did you try on an other host then localhost ?;-)

	François





> All I can say is that it _should_ work and it works here, the awk example you 
> gave works fine here.
> void@kafka:~$ ssh root@localhost "nslookup www.google.com; ping -c 2 
> 192.168.0.1; ping -c 2 192.168.0.2; ping -c 2 192.168.0.3; uname -a; echo 
> \"This seems to work here\"; ssh -V"
> root@localhost's password:
> Note:  nslookup is deprecated and may be removed from future releases.
> Consider using the `dig' or `host' programs instead.  Run nslookup with
> the `-sil[ent]' option to prevent this message from appearing.
> Server:         195.130.130.5
> Address:        195.130.130.5#53
> 
> Non-authoritative answer:
> Name:   www.google.com
> Address: 216.239.39.99
> 
> PING 192.168.0.1 (192.168.0.1): 56 data bytes
> 64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=0.6 ms
> 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.3 ms
> 
> --- 192.168.0.1 ping statistics ---
> 2 packets transmitted, 2 packets received, 0% packet loss
> round-trip min/avg/max = 0.3/0.4/0.6 ms
> PING 192.168.0.2 (192.168.0.2): 56 data bytes
> 64 bytes from 192.168.0.2: icmp_seq=0 ttl=255 time=0.1 ms
> 64 bytes from 192.168.0.2: icmp_seq=1 ttl=255 time=0.1 ms
> 
> --- 192.168.0.2 ping statistics ---
> 2 packets transmitted, 2 packets received, 0% packet loss
> round-trip min/avg/max = 0.1/0.1/0.1 ms
> PING 192.168.0.3 (192.168.0.3): 56 data bytes
> 64 bytes from 192.168.0.3: icmp_seq=0 ttl=64 time=0.4 ms
> 64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=0.4 ms
> 
> --- 192.168.0.3 ping statistics ---
> 2 packets transmitted, 2 packets received, 0% packet loss
> round-trip min/avg/max = 0.4/0.4/0.4 ms
> Linux kafka 2.4.18 #2 Thu Apr 11 14:37:17 EDT 2002 sparc64 GNU/Linux
> This seems to work here
> OpenSSH_3.6.1p2 Debian 1:3.6.1p2-4, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
> void@kafka:~$
> 
> 


-- 
Debian SID
Linux tanna 2.6.0-test2 #10 Tue Aug 5 13:36:17 CEST 2003 i686 GNU/Linux
Linux Counter #59413
PGP fingerprint : 9AFA 15EC 96C9 F607 EBC1  DD41 70C5 F0E0 25A5 105B

Attachment: pgppi_8j9b0Ue.pgp
Description: PGP signature


Reply to: