Re: ssh remote command problem;



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?
.



Relevant Pages

  • Re: [openssh] What env variables does scp set on remote?
    ... > HP> When ssh connects to a remote machine it sets a handy ... > when its ssh as HP> against a console login. ... > execution (such as is used for scp) as opposed to a remote shell. ...
    (comp.security.ssh)
  • Re: nice and ssh/scp
    ... >>Is there a way to nice the remote end of an ssh or scp session? ... >>even enrypting for scp. ... the other is CPU bound and ...
    (Debian-User)
  • Re: executing diff command and scp in a script not working..
    ... There are certain files missing in B..On finding the missing files I ... I wanted to scp all the missing files in file2 from a remote ... machine to my local machine under /home/username/folder2.. ...
    (comp.unix.shell)
  • Re: scp between remote hosts.
    ... slea> to authenticate via password. ... but it's not inherent in scp being executed remotely; ... only because there's no pty and scp uses ssh -n in running the remote ...
    (comp.security.ssh)
  • Re: Piping and scripts with scp
    ... generate one key pair for every command you want to run and name the key ... if you invoke scp with the corresponding key, scp's remote invocation is ... The script will need to execute via cron and run ...
    (FreeBSD-Security)