LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   ssh "LocalCommand" won't work (https://www.linuxquestions.org/questions/slackware-14/ssh-localcommand-wont-work-887177/)

fl0 06-19-2011 10:32 AM

ssh "LocalCommand" won't work
 
Hi @all,

i try to use the LocalCommand feature from openssh.

this is my ~/.ssh/config

Code:

PermitLocalCommand yes
#LocalCommand rsync -e ssh %d/testfile %r@%n:testfile

Login via PublicKey works, and the rsync also works alone, but if i activate this and try to login ssh hangs.

some ideas?

cfdisk 06-19-2011 10:52 AM

Are you saying that you are unable to use rcp, scp or sftp, right?
To any other remote system or just the particular one?

fl0 06-19-2011 10:55 AM

Quote:

Originally Posted by cfdisk (Post 4389975)
Are you saying that you are unable to use rcp, scp or sftp, right?
To any other remote system or just the particular one?

no, i only unable to use the LocalCommand feature, ssh,scp,rsync,scp standalone works well

here some debug output:

Quote:

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/fl0/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp 09:28:15:57:d0:18:81:47:88:d8:40:99:d4:a4:59:20
debug3: sign_and_send_pubkey: RSA 09:28:15:57:d0:18:81:47:88:d8:40:99:d4:a4:59:20
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.0.3 ([192.168.0.3]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug3: Executing /bin/bash -c "rsync -e ssh /home/fl0/testfile fl0@192.168.0.3:testfile"

cfdisk 06-19-2011 11:04 AM

Hmm, what a particular reason of using that LocalCommand feature?
Is there any workaround to bypass or replace it, in other words, what are you trying to accomplish?

fl0 06-19-2011 11:10 AM

Quote:

Originally Posted by cfdisk (Post 4389986)
Hmm, what a particular reason of using that LocalCommand feature?
Is there any workaround to bypass or replace it, in other words, what are you trying to accomplish?

ok i will transfer some config files to the remote host (many hosts), like .inputrc, .bashrc ..... every time i log in.

cfdisk 06-19-2011 11:20 AM

But that's scp made for:

Code:

SCP(1)                    BSD General Commands Manual                  SCP(1)

NAME
    scp -- secure copy (remote file copy program)

SYNOPSIS
    scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
        [-l limit] [-o ssh_option] [-P port] [-S program]
        [[user@]host1:]file1 ... [[user@]host2:]file2

And you said that scp works fine, right?

fl0 06-19-2011 11:22 AM

Quote:

Originally Posted by cfdisk (Post 4389998)
But that's scp made for:

Code:

SCP(1)                    BSD General Commands Manual                  SCP(1)

NAME
    scp -- secure copy (remote file copy program)

SYNOPSIS
    scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
        [-l limit] [-o ssh_option] [-P port] [-S program]
        [[user@]host1:]file1 ... [[user@]host2:]file2

And you said that scp works fine, right?

no, scp copies the file if the file have changed or not, rsync is better...
and scp is also not working in localcommand...

all commands like rsync,scp ... working with the same parameters from the shell but not in LocalCommand

fl0 06-19-2011 12:13 PM

ok i need to correct this, scp works!

but why rsync not?

Reuti 06-19-2011 12:26 PM

Won’t your current setup create an endless loop? You first login successfully, as a result you want to execute in localcommand an rsync which uses another ssh. Hence it will connect again... So it must be avoided for future invocations:
Code:

PermitLocalCommand yes
LocalCommand rsync -e "ssh -o permitlocalcommand=no" %d/testfile %r@%n:testfile


fl0 06-19-2011 12:59 PM

Quote:

Originally Posted by Reuti (Post 4390037)
Won’t your current setup create an endless loop? You first login successfully, as a result you want to execute in localcommand an rsync which uses another ssh. Hence it will connect again... So it must be avoided for future invocations:
Code:

PermitLocalCommand yes
LocalCommand rsync -e "ssh -o permitlocalcommand=no" %d/testfile %r@%n:testfile



yes you are right, thanks.


All times are GMT -5. The time now is 08:08 AM.