how do i scp .dotfiles??

Bill Campbell freebsd at celestial.com
Fri Aug 27 18:43:12 UTC 2010


On Fri, Aug 27, 2010, Gary Kline wrote:
>On Fri, Aug 27, 2010 at 10:29:14AM -0700, Bill Campbell wrote:
>> On Fri, Aug 27, 2010, Gary Kline wrote:
>> >
>> >guys,
>> >
>> >this is the start of my master switchover.  how to i copy/scp,say,
>> >~/.purpur to home/kline/.purple?  along with many hundreds of other
>> >dot files? scp doesn't do it.
>> >
>> scp -r to recursively copy directories?  That should get
>> everything in each directory.
>> 
>> We tend to use rsync for this, making an initial copy to get the
>> majority of the files transferred before making the final cut
>> over, the ``rsync --delete ...'' to bring things up to date
>> before making the final switch.  When switching to a new mail
>> server we have done this live with about 10,000 users, but when
>> we did this, we left the Maildir stores empty before the final
>> rsync and didn't use --delete on the Maildir directories.  This
>> allowed new mail to be processed as it came in, and the older
>> mail wouldn't conflict as the Maildir message file names should
>> be unique.
>> 
>
>	So what would the rsync line be starting from ~kline and pointing
>	at ethiv?  ethic is my temporary savings machine while i install
>	the "newtao", m y new desktop.

Assuming that ~kline is /home/kline and will go to /home/kline on
the remote machine this would work (decoding the options is left
as an exersize for the student :-).

cd /home
rsync -vaHrP kline othermachine:/home

A more general solution that doesn't require ssh, but connects to
the rsync daemon on the remote machine might be to create a
module definition in the destination machine's /etc/rsyncd.conf
file something like this:

[myhome]
	uid = myusername
	gid = mygroupname
	read only = false
	use chroot = true
	path = /path/to/myhomedirectory
	comment = /path/to/myhomedirectory
	hosts allow = sourceipaddress
	hosts deny = *

Then the rsync command could be:

rsync -vaHrP ~/kline/ othermachine::myhome/

This has a couple of advantages.  First the destination uid:gid
can be different on the destination machine as rsync uses the
names in the group and passwd database.  Assuming you're on a LAN
where ssh security isn't critical using the daemon/module
approach doesn't require ssh authorized_keys, and can be
restricted to one or more IP addresses or CIDR blocks.

We use this when moving between systems where the uid:gid mapping
is different when moving between machines of differing OS
releases (e.g. SuSE Linux to FreeBSD), or where the destination
machine may have existing users with conflicting uid:gid s

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

... because most politicians and bureaucrats are technological idiots,
it's going to be crucial for the rank and file members of the IT community
to find its collective voice soon.
    --Michael Vizard, InfoWorld Editor in Chief.


More information about the freebsd-questions mailing list