rsync and ssh for MyBook World Ed (white)
Forum » Forum / My Book World Edition (white light) » rsync and ssh for MyBook World Ed (white)
Started by: hardwaremhardwarem
On: 1246480706|%e %b %Y, %H:%M %Z|agohover
Number of posts: 8
rss icon RSS: New posts
rsync and ssh for MyBook World Ed (white)
hardwaremhardwarem 1246480706|%e %b %Y, %H:%M %Z|agohover

Call me an idiot if you will, but I am stuck. I am attempting to do something SIMPLE. On a networked machine, I want to run a cron job that will copy a directory tree to the MyBook. To do this (and not enter a password) requires an SSH connection.

So, I created a certificate on the network machine (client). Then, I sent the public key to MyBook and stored it in the ~/.ssh/authorized_keys on MyBook (had to create folder). I updated the sshd_config to include:

PubkeyAuthentication yes
AuthorizedKeysFile    .ssh/authorized_keys

When I attempt to connect via ssh, I get:

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to MyBook [192.168.168.100] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'MyBook' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
root@MyBook password:

What is going wrong? Has someone else got their (white) MyBook working with rsync?? PLEASE help.

unfold rsync and ssh for MyBook World Ed (white) by hardwaremhardwarem, 1246480706|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
david_tre07david_tre07 1246486774|%e %b %Y, %H:%M %Z|agohover

Did you change the permissions of the root folder?
chmod og-w /root

Also verify that .ssh right are 700 and files inside 600

Regards.

unfold Re: rsync and ssh for MyBook World Ed (white) by david_tre07david_tre07, 1246486774|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
david_tre07david_tre07 1246487160|%e %b %Y, %H:%M %Z|agohover

In addition, I have allready writed a script that I start on the WD disk with cron.
Before using it you need bash, cron (ipkg install cron bash).

Here it is (Sorry the comments are in French) :

#!/opt/bin/bash

remoteHost=192.168.1.10
remotePort=22
remotePath=/shares/Download/

localPath=/shares/SYNC/

lockFile=/tmp/sync.lock
logFile=/var/log/sync.log

RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh

exec >> $logFile 2>&1
#Un fichier de lock existe deja on s'arrete
if [ -f $lockFile ]
then
  echo "[`date`] un fichier de lock existe deja on s'arrete"
  exit 1
fi

echo "[`date`] Demarrage du sync"
#On tag le demarrage
/bin/touch $lockFile
$RSYNC -avz --partial --append-verify -e "$SSH -p $remotePort" $localPath root@shield:$remotePath
/bin/rm -f $lockFile
echo "[`date`] fin du sync"
unfold Re: rsync and ssh for MyBook World Ed (white) by david_tre07david_tre07, 1246487160|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
hardwaremhardwarem 1246487393|%e %b %Y, %H:%M %Z|agohover

1. This is a script to be run from the client computer or the MyBook?
2. Wouldn't this still be prompting for the password?

unfold Re: rsync and ssh for MyBook World Ed (white) by hardwaremhardwarem, 1246487393|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
david_tre07david_tre07 1246491630|%e %b %Y, %H:%M %Z|agohover

This script run from the MyBook
And no password are prompted.

unfold Re: rsync and ssh for MyBook World Ed (white) by david_tre07david_tre07, 1246491630|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
hardwaremhardwarem 1246487725|%e %b %Y, %H:%M %Z|agohover

Permissions are correct.

Using the format of the script below results in:

#rsync -avz --partial -e "/usr/bin/ssh -p 22" /mysqlbackups/ root@duke:/backup/
Enter passphrase for key '/root/.ssh/id_rsa':

and a command without explicit ssh is:

#rsync -avz /mysqlbackups/ admin@duke:/backup/
admin@duke's password:
unfold Re: rsync and ssh for MyBook World Ed (white) by hardwaremhardwarem, 1246487725|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
david_tre07david_tre07 1246491798|%e %b %Y, %H:%M %Z|agohover

Oh I see, it seems that you put a passphrase when you generated the rsa key.
In my config I didn't put a password (passphrase).

Try to re-generate the rsa key without a passphrase.

unfold Re: rsync and ssh for MyBook World Ed (white) by david_tre07david_tre07, 1246491798|%e %b %Y, %H:%M %Z|agohover
Re: rsync and ssh for MyBook World Ed (white)
hardwaremhardwarem 1246549220|%e %b %Y, %H:%M %Z|agohover

DOH! You are right. I used the wrong key. It is amazing how one can overlook the obvious.

Thank you. I will change keys and retry!!

unfold Re: rsync and ssh for MyBook World Ed (white) by hardwaremhardwarem, 1246549220|%e %b %Y, %H:%M %Z|agohover
New post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License