Rsync problem

Preston Kutzner shizzlecash at gmail.com
Thu Jul 9 15:48:20 UTC 2009


jiten jha wrote:
> Friends,
>              As you told . I follow all steps again but when i run "rsync
> ssh " command then it is asking root password.
> Help me to solve that problem .
> 

Do you have "PubkeyAuthentication yes" in your /etc/ssh/sshd_config file
on your remote host?  It should be there by default if you're using
Ubuntu on it.

Also, just out of curiosity, did you set a password on your ssh key?
When creating your ssh key it prompts for an *optional* password.  If
you entered one in at the prompts, that might be the password it's
asking for.  If you did provide a password when creating your ssh keys,
and don't want to use a password with them, you'll have to re-generate
your keys and just hit 'Return/Enter' at the password prompts.  This
will create a set of keys that don't require a password.

>> In the above steps, you don't indicate which machines you're running
>> those commands on.  It would help us figure out what your problem is if
>> you provide that information.
>>
>> One other possibility that would prevent ssh keys from working when
>> connecting to a remote host is wrong file/directory permissions on the
>> remote host.  The .ssh directory should have permissions 700 and the
>> authorized_keys file should be permissions 644, both owned by the
>> appropriate user.
>>
>> You might also have better success following the steps below:
>>
>> 1> You can skip steps 1-3 of the original steps you listed if you still
>> have the keys you generated originally
>>
>> 2> You'll want to make sure PermitRemoteLogin = yes is enabled in
>> /etc/ssh/sshd_config and that you issue a sudo /etc/init.d/ssh restart
>> on the remote box (if you changed the file) before proceeding to the
>> next steps.
>>
>> 3> Assuming you're copying the id_rsa.pub key from the local machine to
>> a remote host, you want to use the command: 'scp <path_to>/id_rsa.pub
>> <user>@<remote_host>:' (In the case you stated above, "scp
>> <path_to>/id_rsa.pub root at 10.0.0.91:")
>>
>> 4> Then, issue the command: ssh root@<remote_host> "if [ -d \".ssh\"];
>> then cat id_rsa.pub >> .ssh/authorized_keys; else mkdir .ssh; chmod 700
>> .ssh; cat id_rsa.pub >> .ssh/authorized_keys; fi"
>>
>> NOTE QUOTES ABOVE:  The above command essentially logs in via ssh, runs
>> the command(s) in quotes that follow the ssh login command, then closes
>> the session after the command has completed.  Since the command you want
>> run on the remote server must be in double-quotes on the local host, you
>> must escape any quotes that will be part of the command run on the
>> remote host.
>>
>> Also, the above command checks for the existence of a .ssh directory in
>> the user's home, if it exists it then cats out the ssh key to the
>> authorized_keys file in .ssh (and creates the file if it doesn't exist).
>>  If it does not find a .ssh directory, it creates one, sets the
>> appropriate permissions, then cats the ssh key out to the
>> authorized_keys file (again, creating the file if it doesn't exist).
>>
>> 5> run the command: rsync -avr -e "ssh -i
>> <path_to_home_dir>/.ssh/<ssh_key>" /path/on/local/machine
>> user at host:/path/to/dest
>>
>> PLEASE NOTE USE OF QUOTES IN ABOVE STEP, THIS IS IMPORTANT!  You can
>> omit the -i <path_to_home_dir>/.ssh/<ssh_key> portion if using your
>> user's default ssh key.  Otherwise, you must specify the ssh_key if
>> you're using one different from the user's default.  Also, be mindful of
>> trailing slashes in directory paths, as they do change the behavior of
>> rsync.
>>
>> Those steps should get you to where you need to be.  I tried to make
>> them a little more generalized to be portable to any situation.
>>
>> --
>> ubuntu-users mailing list
>> ubuntu-users at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>>
> 
> 
> 





More information about the ubuntu-users mailing list