The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

#1 2004-07-04 14:37:37

noel
All your Noel are belong to us
From: Detroit, MI
Registered: 2004-06-02
Posts: 1184
Website  Expertise

Use rsync and ssh to backup your site.

This is written from a Mac OS X users perspective. It applies to other unix types too!

1) open a terminal window.
2) type 'ssh-keygen -d'
3) if you haven't enabled ssh yet, all you need to do is copy ~/.ssh/id_dsa.pub to your ftp server /home/username/.ssh/authorized_keys. If you already have an authorized keys file, take direction from the following: http://www.cactusdata.co.uk/~bkeitch/howto/backup.html
4) to sync your directories use this command...

rsync -a "username@one.textdrive.com:/home/username/public_html" /path/to/local/backupdir/ --times --links --recursive --hard-links -e ssh --progress --delete

5) If it doesn't work, you messed something up, look over here: http://www.cactusdata.co.uk/~bkeitch/howto/backup.html That is how I figured this all out!

Comments, suggestions?

Last edited by noel (2004-09-10 17:53:15)


noel jackson | http://jcksn.com

Offline

 

#2 2004-07-04 15:58:24

jason
a chief (i started this place)
From: San Francisco
Registered: 2004-06-01
Posts: 8821
Website  Expertise

Re: Use rsync and ssh to backup your site.

nice. this is something for the knowledgebase, would that be okay?

Offline

 

#3 2004-07-05 02:36:20

Jennifer
Member
From: Michigan
Registered: 2004-07-01
Posts: 135
Website  Expertise

Re: Use rsync and ssh to backup your site.

OOh, great work. Thanks! :)

Offline

 

#4 2004-07-05 03:33:16

russh
New member
Registered: 2004-06-20
Posts: 28
Website  Expertise

Re: Use rsync and ssh to backup your site.

Is shell access needed to use this tip?


less than you think.

Offline

 

#5 2004-07-05 16:35:00

noel
All your Noel are belong to us
From: Detroit, MI
Registered: 2004-06-02
Posts: 1184
Website  Expertise

Re: Use rsync and ssh to backup your site.

nope, shell access is not needed. and yes, please put it in the knowledge base!


noel jackson | http://jcksn.com

Offline

 

#6 2004-07-05 22:33:32

froehle
VC200 Member
From: Berkeley, CA
Registered: 2004-06-01
Posts: 38
Website  Expertise

Re: Use rsync and ssh to backup your site.

Works like a champ. You can use it to upload to your Textdrive account, but be aware it might mess up your permissions a little.

Offline

 

#7 2004-09-05 14:33:41

robertbrook
New member
From: London, UK
Registered: 2004-06-01
Posts: 27
Website  Expertise

Re: Use rsync and ssh to backup your site.

noel wrote:

This is written from a Mac OS X users perspective. It applies to other unix types too!

1) open a terminal window.
2) type 'ssh-keygen -d'
3) if you haven't enabled ssh yet, all you need to do is copy ~/.ssh/id_dsa.pub to your ftp server /home/username/.ssh/authorized keys. If you already have an authorized keys file, take direction from the following: http://www.cactusdata.co.uk/~bkeitch/howto/backup.html
4) to sync your directories use this command...

rsync -a "username@one.textdrive.com:/home/username/public_html" /path/to/local/backupdir/ --times --links --recursive --hard-links -e ssh --progress --delete

5) If it doesn't work, you messed something up, look over here: http://www.cactusdata.co.uk/~bkeitch/howto/backup.html That is how I figured this all out!

Comments, suggestions?

"/home/username/.ssh/authorized keys" above refers to a file called "authorized_keys" ( note underscore ) into which you will have copied your id_dsa.pub file contents.

Last edited by robertbrook (2004-09-05 21:17:56)

Offline

 

#8 2004-09-28 03:38:26

Brad Smith
Member
From: Vancouver, BC
Registered: 2004-06-01
Posts: 264
Website  Expertise

Re: Use rsync and ssh to backup your site.

I'm trying this right now, but there doesn't seem to be a .ssh directory. Is that normal?

Offline

 

#9 2004-09-28 03:58:05

jason
a chief (i started this place)
From: San Francisco
Registered: 2004-06-01
Posts: 8821
Website  Expertise

Re: Use rsync and ssh to backup your site.

sometime on the good 'ole mac, there won't be .ssh directory. Just make one.

Offline

 

#10 2004-09-28 04:00:00

Brad Smith
Member
From: Vancouver, BC
Registered: 2004-06-01
Posts: 264
Website  Expertise

Re: Use rsync and ssh to backup your site.

But there should be one on the server, right? I have a .ssh directory on my Mac, just not on the server. Or am I reading/understanding the instructions wrong?

Offline

 

#11 2005-09-28 17:24:34

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Use rsync and ssh to backup your site.

Can we get a similar tutorial for non-Unix machines? Windows, please.

Offline

 

#12 2005-10-02 02:52:37

acastro
Member
From: London
Registered: 2005-09-09
Posts: 115
Website  Expertise

Re: Use rsync and ssh to backup your site.

Uhm... Answering my own question:

David Barnett's rsync tutorial suits me just fine.

http://www.antidis.com/articles/2005/08/windows-rsync/

It's working like a charm.

Offline

 

#13 2006-03-02 02:40:17

dance
Member
From: UK
Registered: 2006-02-25
Posts: 110
Expertise

Re: Use rsync and ssh to backup your site.

Brad Smith wrote:

But there should be one on the server, right? I have a .ssh directory on my Mac, just not on the server. Or am I reading/understanding the instructions wrong?


It seems that the folder is there, just invisible. You have to directly key in its location. Having said that, I'm having a lot of trouble following the knowledgebase article. If you follow it word for word, it just doesn't work. There are steps missing and too many assumptions made. Has anyone got it working on a Mac and would care to share how they did so? Or make amendments to the kb? So many tutorials on this on the internet have completely different flags for the initial keygen command.

Offline

 

#14 2006-03-02 02:52:07

Andy
Dabbler
From: London
Registered: 2005-01-15
Posts: 1177
Website  Expertise

Re: Use rsync and ssh to backup your site.

The ~/.ssh folder (which is /Users/username/.ssh on Mac OS X) may or may not be already created, depending on whether you've used SSH before or not. Folders that are prefixed with a dot are normally hidden in the Finder as normally you don't frequently access them and they would otherwise clutter up your Finder windows (also, they're used for config stuff, and you don't want to mess around with that if you don't know what you're doing).

As for the ssh-keygen flags, the only thing you really have to specify is the type of key you want to use (DSA etc). This is done with the -t flag:

$ ssh-keygen -t dsa

As near as I can tell, the -d that is mentioned up above and in kb.textdrive.com is the same as '-t dsa'.

If there's any other problem you're having, feel free to post with details on which bit in particular is causing a stumbling block. Hope this helps.


— Andy (andrewlkho)

Offline

 

#15 2006-03-02 03:16:44

dance
Member
From: UK
Registered: 2006-02-25
Posts: 110
Expertise

Re: Use rsync and ssh to backup your site.

Thanks, Andy. I might just take you up on that. Firstly, though, here:

dance wrote:

It seems that the folder is there, just invisible.


I was (hopefully!) answering a question about the ssh folder on the remote, not Mac OS X, server.

kb wrote:

1. Open a terminal window
2. Type ssh-keygen -d to generate your ssh keys
3. Copy the contents of your public key ~/.ssh/id_dsa.pub in you local directory to the file /home/username/.ssh/authorized_keys on your TextDrive account.


This is the troublesome section of the kb - it just doesn't follow on! For example,
2. keygen asks me what to save the file as after step 2 and I'm not told what to call it. In addition any files generated end up in ~/ and not ~/.ssh/
3. copy the contents of id_dsa.pub to a file or copy the file to a folder?

Thanks!

Last edited by dance (2006-03-02 03:17:30)

Offline

 

#16 2006-03-02 03:47:12

Andy
Dabbler
From: London
Registered: 2005-01-15
Posts: 1177
Website  Expertise

Re: Use rsync and ssh to backup your site.

Sure, no problem. It doesn't matter where you create your keys using ssh-keygen, as you can move them right after they've been created. ssh-keygen creates two files, id_dsa and id_dsa.pub. You want both of these to be in ~/.ssh (so just move them afterwards if they're in ~/)

$ mv ~/id_dsa* ~/.ssh/

This is on your local machine (which, I believe, is Mac OS X). Next, the ~/.ssh directory on the server needs to contain a file called authorized_keys. This should just contain a line with your public key in it -- if you're only using one key then you can just upload id_dsa.pub and rename it to ~/.ssh/authorized_keys on the remote server.


— Andy (andrewlkho)

Offline

 

#17 2006-03-02 14:37:32

dance
Member
From: UK
Registered: 2006-02-25
Posts: 110
Expertise

Re: Use rsync and ssh to backup your site.

Andy you're a hero. You succinctly yet comprehensively solved my problem. The problem was that my private key wasn't stored in my Mac's ssh repository so even though my public key was correctly configured on the server, things weren't working out.

I find that to login without a password I must type ssh username@hostname.tld and not just ssh hostname.tld. If I attempt the latter I'm still prompted for a password.

This is excellent. Thank you.

Offline

 

#18 2006-03-02 14:40:50

Andy
Dabbler
From: London
Registered: 2005-01-15
Posts: 1177
Website  Expertise

Re: Use rsync and ssh to backup your site.

You're welcome.


— Andy (andrewlkho)

Offline

 

#19 2006-03-02 19:36:42

danny
Member
From: Rio de Janeiro, Brazil
Registered: 2005-02-23
Posts: 295
Website  Expertise

Re: Use rsync and ssh to backup your site.

dance wrote:

I find that to login without a password I must type ssh username@hostname.tld and not just ssh hostname.tld. If I attempt the latter I'm still prompted for a password.


That happens because you are using a different username on the server than on your Mac.


"You can swim all day in the Sea of Knowledge and still come out completely dry. Most people do." --Norman Juster, The Phantom Tollbooth

Offline

 

#20 2006-03-02 19:39:39

dance
Member
From: UK
Registered: 2006-02-25
Posts: 110
Expertise

Re: Use rsync and ssh to backup your site.

Yeah, I figured as much! Thanks all!

Offline

 

#21 2010-07-17 05:15:24

jcherfas
Member
From: Rome, Italy
Registered: 2005-03-06
Posts: 199
Website  Expertise

Re: Use rsync and ssh to backup your site.

I don't seem able to find the Knowledge Base article referred to. Can anyone point me to it. And given that this thread was started a while ago, are there any updates?

Thanks


Jeremy
VC IV

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson