NEWB NEEDS HELP: rsync and ssh and PERL
NEWB NEEDS HELP: rsync and ssh and PERL
am 12.10.2007 21:35:22 von RocketMan
Sorry, I am very new and I can't find any examples of what I want to
do.
I am trying to write a command in a PERL script that will take either
the file or the directory I give it and send it to another server via
ssh. I believe that the ssh part of this command would prompt the
user for name/password if there isn't a key already on the other
server which is what I want to happen.
Here is what I have so far (in PERL)
system("rsync -nre --rsh=\"ssh $destHost \" $localFile $remoteDir");
which should end up as:
rsync -nre --rsh="ssh Host" file remoteDir
Since they haven't set me up yet to test this, I wanted to make sure
that:
1) this will work with both files and directories in the 'file'
position.
2) this will check for a key and if there is not one, prompt for user
name and password.
3) this will actually WORK!?
I read the man page and am confused since I see a -l switch for ssh
and I may or may not know the username in this script.
Please let me know what you think
THANKS
Re: NEWB NEEDS HELP: rsync and ssh and PERL
am 12.10.2007 22:55:22 von Bill Marcum
On 2007-10-12, RocketMan wrote:
>
> I read the man page and am confused since I see a -l switch for ssh
> and I may or may not know the username in this script.
>
If you don't specify the username, and it isn't given in ~/.ssh/config, ssh
assumes that the remote username is the same as the local one.
Re: NEWB NEEDS HELP: rsync and ssh and PERL
am 15.10.2007 23:03:28 von RocketMan
On Oct 12, 2:55 pm, Bill Marcum wrote:
> On 2007-10-12, RocketMan wrote:
>
> > I read the man page and am confused since I see a -l switch for ssh
> > and I may or may not know the username in this script.
>
> If you don't specify the username, and it isn't given in ~/.ssh/config, ssh
> assumes that the remote username is the same as the local one.
so lets say that the username does not exist on the remote
machine...will they be prompted for username / password?
Re: NEWB NEEDS HELP: rsync and ssh and PERL
am 18.10.2007 21:25:54 von jj
RocketMan wrote:
> Sorry, I am very new and I can't find any examples of what I want to
> do.
> I am trying to write a command in a PERL script that will take either
> the file or the directory I give it and send it to another server via
> ssh. I believe that the ssh part of this command would prompt the
> user for name/password if there isn't a key already on the other
> server which is what I want to happen.
> Here is what I have so far (in PERL)
> system("rsync -nre --rsh=\"ssh $destHost \" $localFile $remoteDir");
But rsync won't use the ssh because the destination is a simple directory
spec. It should be
system("rsync -nre --rsh=ssh $localFile $destHost:$remoteDir");
please read the rsync manual again.
> which should end up as:
> rsync -nre --rsh="ssh Host" file remoteDir
> Since they haven't set me up yet to test this, I wanted to make sure
> that:
> 1) this will work with both files and directories in the 'file'
> position.
> 2) this will check for a key and if there is not one, prompt for user
> name and password.
> 3) this will actually WORK!?
> I read the man page and am confused since I see a -l switch for ssh
> and I may or may not know the username in this script.
> Please let me know what you think
> THANKS