# Sharing directories...



## Jcb1974 (Dec 20, 2013)

All,

I've got a real problem with a file server at work. The school district won't pony up for a generator, and so they have an UPS system as a power failover for the data center. The battery life is insufficient to the task. Well, we had a blizzard here, power went out, and in the time that it took me to walk from my office to the data center, servers were already going down hard. Well, when I brought the district file server back up, Samba would no longer authenticate clients against Open Directory and I've not been able to get it to work since. The shares themselves can still be accessed from the network, just not with network credentials. Which is, as you can imagine, all kinds of wrong. Since I'm too junior to fix the issue, I'm just going to start from scratch over the Xmas school break and call it good. In the interim, I need to start moving data off the old file server. I can't get anything to mount on the box, so I can't sneakernet the data off the file server. Since Samba is broke, I can't log into it and pull it down that way. There's only *one* directory I can access on the file server, so I've been reduced to copying files from /store/homes/ into /home/tech/ and then pulling it off that way. I log in via SSH and operate from the command line. Is there a way for me to at least cut out the step of copying data from /store/homes/ to /home/tech, e.g., granting the user tech access to /store/homes? Or something? Man, there's a steep learning curve going from being a help desk technician to UNIX systems administrator in two months.


----------



## SirDice (Dec 20, 2013)

Login with SSH and use scp(1) to copy the data to another machine. Or use something like this:

Pull method
`ssh [email=admin@file.server]admin@file.server[/email] tar -C /base/dir -cf - * | tar -C /local/base/dir -xvf -` # pulls all content in /base/dir from host file.server to a local directory /local/base/dir/.
Push method
`tar -C /base/dir -cf - * | ssh [email=admin@new.server]admin@new.server[/email] tar -C /new/base/dir -xvf -` # pushes all local content in /base/dir to a directory /new/base/dir on host new.server.

That's assuming you can still access the data on the server itself.


----------



## Jcb1974 (Dec 20, 2013)

Thanks ever so much for the help, Dice. I've been watching your replies for a year. You're always so helpful. We'll be neighbors come April of next year. I'm moving to Ablasserdam on the outskirts of Rotterdam. Well, Kinderdijk, really. Anyway, thanks again!


----------



## Jcb1974 (Dec 20, 2013)

When *I* tried to push the data over, this is what I got. 


```
root@topeka:/ # tar -C /store/homes/ -cf - * | ssh root@172.30.115.58 tar -C /Topeka/week01 -xvf -
tar: COPYRIGHT: Cannot stat: No such file or directory
tar: Network: Cannot stat: No such file or directory
tar: bin: Cannot stat: No such file or directory
tar: boot: Cannot stat: No such file or directory
tar: dev: Cannot stat: No such file or directory
tar: entropy: Cannot stat: No such file or directory
tar: etc: Cannot stat: No such file or directory
tar: home: Cannot stat: No such file or directory
tar: host: Cannot stat: No such file or directory
tar: lib: Cannot stat: No such file or directory
tar: libexec: Cannot stat: No such file or directory
tar: media: Cannot stat: No such file or directory
tar: mnt: Cannot stat: No such file or directory
tar: net: Cannot stat: No such file or directory
tar: proc: Cannot stat: No such file or directory
tar: rescue: Cannot stat: No such file or directory
tar: root: Cannot stat: No such file or directory
tar: sbin: Cannot stat: No such file or directory
tar: srv: Cannot stat: No such file or directory
tar: store: Cannot stat: No such file or directory
tar: sys: Cannot stat: No such file or directory
tar: tmp: Cannot stat: No such file or directory
tar: usr: Cannot stat: No such file or directory
tar: var: Cannot stat: No such file or directory
Password:
tar: Error exit delayed from previous errors.
root@topeka:/ #
```

I'm sure I'm missing something simple here, I just don't know what it is.


----------



## phoenix (Dec 20, 2013)

Install rsync and sudo on both systems.  On the new box, add the following line to sudoers(5) configuration (via visudo(8) command): `<yourusername>         ALL = NOPASSWD: RSYNC`

SSH to old file server, then `su`/`sudo` to root.

Then use rsync to transfer the files from the old server to the new one, via SSH: `# rsync --verbose --archive --hard-links --specials --xattrs --rsync-path="sudo rsync" --rsh="ssh" /store/homes/ [email=yourusername@new.server.name]yourusername@new.server.name[/email]:/storage/homes/`

That command can be stopped and started as needed, and will just pick up where it left off (something the tar command won't do).

Note:  ownership will be done by username, so make sure the correct usernames are already on the new server.


----------

