Re: ssh remote command problem;
- From: rpnabar@xxxxxxxxx
- Date: Thu, 6 Dec 2007 21:21:08 -0800 (PST)
On Dec 6, 10:49 pm, Unruh <unruh-s...@xxxxxxxxxxxxxx> wrote:
rpna...@xxxxxxxxx writes:
Hi,
I had an scp/ssh problem that I wanted some suggesstions on:
Background:
So, I use scp very often(say 100 times a day!) to push files from
remote systems on to my home system. Now I dont have much control on
the remote systems but have root access on my home system. Of course,
as far as possible I would prefer to impliment the solution as a
normal user!
Now, for some of the dirs. I scp back I wanted a action to be
automatically taken. i.e. a script to be executed on the home system
with the path of the dir just scp'd back as an argument. This then
would be a convinient automated postprocessing routine. The point is,
I needed a way to trigger this script each time an scp happens.
Something like: ~/bin/run_post_processor.sh $CURRENT_PATH
cd /usr/bin
mv scp scp.orig
/bin/ed scp <<EOF
i
#!/bin/bash
~/bin/run_post_processor.sh $*
/usr/bin/scp.orig $*
.
EOF
chmod a+rx /usr/bin/scp
Or whatever you want to put in there. Of course it would be cleaner if
instead of replacing /usr/bin/scp, you make another one
/usr/bin/scp.personal
or ~/bin/scp.personal
which called /usr/bin/scp
and then always use scp.personal instead of scp, but your fingers will
forget.
Now after browsing through previous posts and the documentaion I know
of the ~.ssh/rc file. Unfortunately 2 problems: (1) It works only with
the ssh command with the scp it just executes but the scp fails (2)
How do I access the scp command-line (or at least tunnel a variable
from the remote system!)
Further I read about the SSH_ORIGINAL_COMMAND variable. But this seems
to be set if I only have the foreign-key mechanism.I use a password
based login(remote systems specify that! not under my control!! ) so
how can I make the system set this variable?
Currently if I echo it through the rc script it is always blank!
Any sugesstions are greatly appreciated! Or any alternative mechanisms
pele have for solving a problem iof this kind!(perhaps even non scp
based? I toyed with the idea of "watching" the file system but a cron
job is just too inefficient! My /home is more than 100GB!! Also, the
intantanous respons of an ssh triggered approach is attractive.)
Thanks again in advance to anybody who has some sugesstions!
-Rahul
PS. I know I could do an ssh with the current dir as an argument
followed by an scp. BUT I do this 100 times a day! So, if I did it
that way its double the executions and I MUST type in a password each
time! (right? or is there a way to batch execute several ssh scp
combinations in a single passowrd session?)
It wont work! U aliased scp on the home system!! That scp is never
invoked. I am scping from the REMOTE SYSTEM. The post_processor is on
HOME_SYSTEM. The post processor on home system needs to respond to an
scp command on remote-system.
I hope you see my problem?
.
- References:
- ssh remote command problem;
- From: rpnabar
- Re: ssh remote command problem;
- From: Unruh
- ssh remote command problem;
- Prev by Date: Re: ssh remote command problem;
- Next by Date: Re: ssh remote command problem;
- Previous by thread: Re: ssh remote command problem;
- Next by thread: Re: ssh remote command problem;
- Index(es):
Relevant Pages
|
|