Rsync problem

Preston Kutzner shizzlecash at gmail.com
Wed Jul 8 16:58:03 UTC 2009


jiten jha wrote:
> Dear friends,
>                  I have a problem in Rsync utility . I done this
> 
> 1> open terminal login super user.
> 2> ssh-key -t rsa
> 3> /root/.ssh/id_rsa.pub
> 4> scp -r root at 10.0.1.72:/root/.ssh/id_rsa.pub root at 10.0.1.91:/root/.ssh/
> 5> cat id_rsa.pub >> /root/.ssh/authorized_keys
> 6> vim /etc/ssh/sshd_config
> 7> PermiRootLogin = yes
> 8> Run this command rsync -r -v -a -e ssh /home/souce computer/
> root at 10.0.1.91:/home/user name /Desktop
> 
> when i follow that setps then it is asking root password .
> Plz help me to solve that problem. I searched on google but not getting
> solution.

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.




More information about the ubuntu-users mailing list