Re: Multiple modes? throught one connection
From: Mike Friedman (mikef_at_ack.Berkeley.EDU)
Date: 09/14/04
- Previous message: MBuselli_at_cccis.com: "Re: REQ: SSH behaviour dependent from the connecting client"
- In reply to: Tim Nelson: "Multiple modes? throught one connection"
- Next in thread: Derek Martin: "Re: Multiple modes? throught one connection"
- Reply: Derek Martin: "Re: Multiple modes? throught one connection"
- Reply: Atro Tossavainen: "Re: Multiple modes? throught one connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 14 Sep 2004 09:31:49 -0700 (PDT) To: Tim Nelson <tim.nelson@webalive.biz>
On Mon, 13 Sep 2004 at 10:09 (+1000), Tim Nelson wrote:
> Hi all. I often want to scp a file somewhere and then run it.
> At the moment, I have to do an scp followed by an ssh (in a script) so I
> need to type the password twice. Is there a way of linking the two
> together somehow so that it will, through the one connection, trnasfer
> the file, and then run the command? If so, is there somewhere that I
> can find documentation on how to do this?
Tim,
Well, something like this might work (I haven't actually tried it):
cat 'file' | ssh $Host 'cat > $File; chmod +x $File; $File'
where '$File' is the name of the file on the remote system ('$Host').
You'd be running three commands on the remote host, using only one ssh
connection:
cat > $File [to retrieve the file sent from stdout on the local
host to stdin on the remote host]
chmod +x $File [to make the remote file executible]
$File [To execute the remote file itself]
(Tweak the above to suit your particular situation).
The main difference between using scp and 'ssh ... cat' to transfer a file
is that the latter doesn't preserve permissions and dates. If you can live
without the date preservation, this should not be a problem.
Mike
------------------------------------------------------------------------------
Mike Friedman System and Network Security
mikef@ack.Berkeley.EDU 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://ack.Berkeley.EDU/~mikef http://security.berkeley.edu
------------------------------------------------------------------------------
- Previous message: MBuselli_at_cccis.com: "Re: REQ: SSH behaviour dependent from the connecting client"
- In reply to: Tim Nelson: "Multiple modes? throught one connection"
- Next in thread: Derek Martin: "Re: Multiple modes? throught one connection"
- Reply: Derek Martin: "Re: Multiple modes? throught one connection"
- Reply: Atro Tossavainen: "Re: Multiple modes? throught one connection"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|