Search

The Joyent Community

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

You are not logged in.

#1 2006-04-28 21:57:38

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

UPDATED -- Backing up to Strongspace

Update 2: I forgot to add the --delete option to the synchronize command. This means that whatever you delete on TextDrive, won't be deleted on StrongSpace. Please see the article to find the new command, and update your scripts!

Update: the article is now live at http://textfilter.org/article/backing-up-to-strongspace

Below is the original draft:

---

I sat down to fix backing up to Strongspace today. Here's how it works. This is a draft cause I'd like to get some verification of all the commands, I'll put it up at TextFilter once it's vetted.

Setting Up SSH

First step in the process is setting up the SSH connection from TextDrive to Strongspace. The problem here is that the login needs to be automatic: when the backup is run as a cron job there's nobody around to enter the password! Unfortunately doing this securely is nigh impossible. There is ssh-agent, which will remember your password, but it is session based

Last edited by Mark Wubben (2006-05-19 11:09:41)


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#2 2006-04-29 10:44:41

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

Re: UPDATED -- Backing up to Strongspace

I had a quick skim through your article, Mark, and that's the method I use (blank SSH key and rsync'ed cron job). There was one stumbling block that I came across, though. Sub-users's Maildirs need to be chmod-ed so that only they can read them, otherwise mail doesn't get delivered. However, this means that the main user can't back up their mail, which was something that I wanted to do.

So, I set up a cron job for the sub-user that rsyncs their Maildir into a folder they can write to (that's actually in the main user's home dir but chgrp-ed and chmod-ed for them), and chmods it so that the main user can read. This runs just before the main backup. I also excluded the original Maildir from the rsync otherwise it'll spit (non-fatal) errors and I like a nice clean sync :).


— Andy (andrewlkho)

Offline

 

#3 2006-04-29 13:47:36

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Thanks Mark!

It takes time and effort to these things. I appreciate and see that it has higher priority than TextPanel, although TextPanel will finally come, right? :)

Offline

 

#4 2006-04-29 15:19:39

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

I don't work for TextDrive so I wouldn't know, ngungo...


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#5 2006-04-29 15:57:24

schussat
Cold-cocking the drill sergeant.
From: Flagstaff
Registered: 2004-06-01
Posts: 1766
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Great walkthrough, Mark. Thanks much.

Andy, could you elaborate a bit on how you backup your maildirs? I don't quite get how mail users can run a cron job.

Offline

 

#6 2006-04-29 20:00:24

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Mark Wubben wrote:

I don't work for TextDrive so I wouldn't know, ngungo...


Oh! I am sorry. My fault, I apologize.

Offline

 

#7 2006-05-02 09:45:01

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#8 2006-05-02 11:44:43

tijs
Member
From: Amsterdam, NL
Registered: 2005-11-13
Posts: 51
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

There is some weird encoding in your textfilter version. See the last rsync command for instance. Fine article! i use a similar setup.

Offline

 

#9 2006-05-02 12:04:23

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Ooh.. how silly. I forgot to remove the BBCode. And I threw in some Markdown for good measure as well!


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#10 2006-05-02 17:36:31

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

Re: UPDATED -- Backing up to Strongspace

schussat wrote:

Andy, could you elaborate a bit on how you backup your maildirs? I don't quite get how mail users can run a cron job.


Via usermin: I have them run something along the lines of

/usr/local/bin/rsync -rltvz --delete /user/home/myusername/domains/mydomain/homes/theirusername/Maildir /somewhere/they/can/write/to


— Andy (andrewlkho)

Offline

 

#11 2006-05-02 17:58:50

schussat
Cold-cocking the drill sergeant.
From: Flagstaff
Registered: 2004-06-01
Posts: 1766
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

usermin! Hah. I didn't even know that was there. Thanks.

So I just replicate the cron job for each user, rsyncing their Maildir to a tree that the main user can read, and chmod it to g+r so that the permissions are correct? Then that tree gets wrapped up in the rsync-to-strongspace script.

Have I got it?

Offline

 

#12 2006-05-02 19:28:37

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Hi Mark,
I will ask silly questions here, but if you prefer me to put my questions at your textfilter I'll post them there.

1. When I SFTP to my strongspace account I did not see any .ssh directory so I create one on my root /home/ngungoatstrongspace/ then upload the authorized_keys file over. Is that OK?

2. The same for TextDrive. I create one on my root /users/home/ngungoattextdrive/ then upload the ss file over. Is that OK?

3. I use FileZilla to set the file ss to 400 since I don't know how to navigate by command line.

4. I login to webmin > Running Processes and type

Code:

  ssh -i ss ngungoatstrongspace@accountname.strongspace.com


I got an error:

Code:

 Warning: Identity file ss does not exist.

Pseudo-terminal will not be allocated because stdin is not a terminal. Host key verification failed.


I guess I (being unix ignorant) don't know how to navigate to the file ss, it could not find the file.

Thanks,
ngungo

Offline

 

#13 2006-05-02 21:05:02

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Ngungo, correct on all counts (and asking here is fine).

You need to provide the absolute path to the "ss" file, something like "/users/home/ngungo/ss".


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#14 2006-05-03 03:47:30

schussat
Cold-cocking the drill sergeant.
From: Flagstaff
Registered: 2004-06-01
Posts: 1766
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

All right, I'm going to throw in one more question for Andy. I think I've got things all figured out and working well, with the exception of an error from rsync about not being able to set the times on my Maildirs. I bet this is the same harmless error you mentioned in your first post. I tinkered with the exclude option in rsync, but that didn't do anything for me. What's the way to exclude the Maildir to suppress that error?

Offline

 

#15 2006-05-03 20:13:03

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Man! Feel awfully stupid! I haven't made it work yet!

Hi Mark,

I've been trying many times every steps over, what was that possible wrong thing I making this time.

Code:

 Output from ssh -i /users/home/ngungo/.ssh/ss ngungo@ngungo.strongspace.com ..
 Pseudo-terminal will not be allocated because stdin is not a terminal.
 Host key verification failed.

Offline

 

#16 2006-05-04 07:16:55

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Might just not work through Webmin.


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#17 2006-05-04 17:13:26

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Should I turn in a ticket, provided I have ssh files on both sides? All I want is ability to backup to StrongSpace.

Offline

 

#18 2006-05-04 17:27:44

schussat
Cold-cocking the drill sergeant.
From: Flagstaff
Registered: 2004-06-01
Posts: 1766
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

ngungo, have you tried testing this at a shell? It does work fine there. Mark's suggestion that it may not work through webmin is a good one.

Offline

 

#19 2006-05-04 17:48:47

ngungo
a monpageur
Registered: 2004-06-01
Posts: 3421
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

schussat wrote:

ngungo, have you tried testing this at a shell? It does work fine there. Mark's suggestion that it may not work through webmin is a good one.


I use Windows XP, how do I get into a shell?

Offline

 

#20 2006-05-06 11:03:42

konstantinos
Member
From: Greece
Registered: 2005-03-02
Posts: 40
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

ngungo wrote:

I use Windows XP, how do I get into a shell?


PuTTY.

Offline

 

#21 2006-05-07 20:31:23

konstantinos
Member
From: Greece
Registered: 2005-03-02
Posts: 40
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

I've set everything up, the test command runs fine but when the cron job runs I get the following message:

: Permission denied
invalid characters in scp command!
here:
try using a wildcard to match this file/directory
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(443)


Any ideas as to what's going wrong?

Bonus question: if the authorized_keys file has already got a key on it, how do we add the content of another key? Blank line at the end of the file and paste the other key there?

Thanks for your help in advance.

Last edited by konstantinos (2006-05-07 20:32:14)

Offline

 

#22 2006-05-08 07:31:31

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

End of the file, yeah. Not sure what's up with the invalid character error, what are the file/dir names you're syncing?


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#23 2006-05-08 12:18:13

konstantinos
Member
From: Greece
Registered: 2005-03-02
Posts: 40
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Mark Wubben wrote:

End of the file, yeah. Not sure what's up with the invalid character error, what are the file/dir names you're syncing?


Here you go:

#!/bin/sh

/usr/local/bin/rsync -azq -e "ssh -i /home/XYZ/.ssh/ss" /home/XYZ/domains/ XYZ@XYZ.strongspace.com:/home/XYZ/txd-backup/weekly/domains/
/usr/local/bin/rsync -azq -e "ssh -i /home/XYZ/.ssh/ss" /home/XYZ/backups/databases/ XYZ@XYZ.strongspace.com:/home/XYZ/txd-backup/weekly/databases/

Offline

 

#24 2006-05-08 15:32:03

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Hmm, perhaps some oddly named files inside those directories?


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#25 2006-05-08 21:46:29

konstantinos
Member
From: Greece
Registered: 2005-03-02
Posts: 40
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Mark Wubben wrote:

Hmm, perhaps some oddly named files inside those directories?


Nah, nothing out of the ordinary, AFAIK. Do you think this is an issue I should address to the TxD folks?

Offline

 

#26 2006-05-10 13:30:34

konstantinos
Member
From: Greece
Registered: 2005-03-02
Posts: 40
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

A bump, in case someone out there knows what's causing this issue.

If not, I'll have to file a ticket with TxD I think.

Offline

 

#27 2006-05-19 11:10:01

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

I forgot to add the --delete option to the synchronize command. This means that whatever you delete on TextDrive, won't be deleted on StrongSpace. Please see the article to find the new command, and update your scripts!


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#28 2006-07-20 18:29:54

MattH
New member
Registered: 2006-04-18
Posts: 28
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

OK, I have spent all day trying to get this sorted out, but without (much) success. Maybe someone here might know what I am doing wrong?

The story so far:

I have generated the keyfiles as above, renamed the ss.pub to authorized_keys via the command line, and uploaded them as follows:

Textdrive:
/users/home/USERNAME/.ssh/ss <- chmod'd to 400

Strongspace:
/home/matthall/.ssh/authorized_keys <- 644

When I try to connect over ssh to the server via my textdrive shell, I am still prompted for my strongspace password.

Any help at all would be greatly appreciated!

Offline

 

#29 2006-07-20 20:21:52

lderezinski
Happy Camper
From: Essex, Maryland USA
Registered: 2006-04-14
Posts: 4185
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

make sure you do not have a passphrase on the keys.

See step 3 here: http://www.akadia.com/services/ssh_test … icate.html


The greatest oak was once a little nut who held its ground.
MG->3ML->Premiere (Lithographer) + Accelerati + Joyeur (Yes, I work here, we are hiring)

Offline

 

#30 2006-07-20 20:25:02

MattH
New member
Registered: 2006-04-18
Posts: 28
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Yeah, the keys have no passphrase - I am being asked for my StrongSpace password.

Thanks, though!

Offline

 

#31 2006-07-21 23:58:26

MattH
New member
Registered: 2006-04-18
Posts: 28
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

OK, My problem has been resolved:

Make sure that the .ssh directory on StrongSpace is chmod 700, and the authorized_keys file is chmod 600.

Tally-ho!

Oh, I posted every single step I took to set the keys up on my blog here:

SSH Access to StrongSpace from Textdrive

Last edited by MattH (2006-12-11 23:24:50)

Offline

 

#32 2006-07-24 17:55:26

philgyford
Member
From: London, UK
Registered: 2006-06-19
Posts: 68
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

I'm trying to backup stuff up from TextDrive to Strongspace following these instructions and am part way there.

However, if I try to SSH into Strongspace from TD I'm always prompted for my passphrase. I can't work out what step I'm missing in order to be able to SFTP to Strongspace without a password or passphrase. Any ideas?

Offline

 

#33 2006-07-25 12:50:33

roeland
Member
From: Belgium
Registered: 2004-12-18
Posts: 146
Expertise

Re: UPDATED -- Backing up to Strongspace

I created a simple backup script:
http://textsnippets.com/posts/show/587


VC3 -> MG -> 3ML -> Empire -> 2x Premier -> Premier + 1/2GB Accelerator

Offline

 

#34 2006-07-25 16:46:43

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

roeland, where do you configure the password?


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#35 2006-07-25 22:12:57

roeland
Member
From: Belgium
Registered: 2004-12-18
Posts: 146
Expertise

Re: UPDATED -- Backing up to Strongspace

Mark Wubben wrote:

roeland, where do you configure the password?


The password for mysql is in the the PWD_MYSQL variable.
For Strongspace I just use the ssh keys like you explained.

Or do you mean something else?


VC3 -> MG -> 3ML -> Empire -> 2x Premier -> Premier + 1/2GB Accelerator

Offline

 

#36 2006-07-25 23:57:09

Mark Wubben
sIFR dev
From: Copenhagen
Registered: 2004-08-17
Posts: 6271
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

Ah, I missed the SSH keys bit :)


"The angels stole my phone box" – The Tenth Doctor

Offline

 

#37 2007-02-02 19:01:30

mrdale
Member
Registered: 2005-03-02
Posts: 208
Expertise

Re: UPDATED -- Backing up to Strongspace

>Mark Wubben:

Off topic I know, but could the keys part of this be used so that you can set up an automator applet via FUSE to automount a textdrive account without having to enter a password?


★ nelson (fare-thee-well, old unreliable) ★ johnson ★ bolinas ★ Sx2 ★

Offline

 

#38 2007-02-02 20:22:36

juxta
El Jefe
From: California
Registered: 2005-10-28
Posts: 499
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

The SSH keys part works with SSH in general so, yes, FUSE should login fine without asking for a password if you set them up.

At least mine does ;)

Last edited by juxta (2007-02-02 21:15:25)

Offline

 

#39 2007-09-05 09:04:51

jdjustice
Perpetual Optimist
From: North Carolina
Registered: 2007-08-13
Posts: 215
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

ok I have gone through this procedure a few times and for some odd reason cannot get it to work.
I have followed the steps and the files are in proper position and permissions are set correctly I think.
I have no trouble accessing StrongSpace using the public key without a password in the shell.

This is the (simple) error message I am getting; rsync stars to work and then after beginning I get:

Code:

USERNAME@SS_USERNAME.strongspace.com:/home/SS_USERNAME/joyentbackups/allsitesweekly/: not found


..when I have created the '/joyentbackups/allsitesweekly/' folders in StrongSpace at the root.

there must be something very simple I am overlooking as I cannot understand why I am getting a not found message for a directory that does indeed exist.

thanks in advance for any suggestions!
~J.D.

Offline

 

#40 2007-10-03 03:14:04

jdjustice
Perpetual Optimist
From: North Carolina
Registered: 2007-08-13
Posts: 215
Website  Expertise

Re: UPDATED -- Backing up to Strongspace

ok i am still struggling with this but now I am getting a different error message!! Can anyone give me some assistance with this if you have the time?

Code:

rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
/users/home/USERNAME/scripts/joyent_entire_structure_backup_wk.sh: SS_USERNAME@USERNAME.strongspace.com:/home/USERNAME/joyentbackups/allsitesweekly/: cannot execute


I'm pretty sure everything was done according to this thread and the previous posters blog posting (which was very helpful).

Thanks in advance!!
~J.D.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson