Re: copy server to server retaining chmod and ownership?
news_at_celticbear.com
Date: 11/14/05
- Next message: Peter T. Breuer: "Re: restored partition with systemrescue, can't boot"
- Previous message: Robert Heller: "Re: Linux and Viruses"
- In reply to: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Next in thread: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Reply: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Nov 2005 12:03:10 -0800
Peter T. Breuer wrote:
> news@celticbear.com <news@celticbear.com> wrote:
> > I have 32GB of files and directories to copy from one server to
> > another.
> > But when I use scp it converts all the ownership to the user I scp'ed
> > through.
>
> What would you expect? That user cannot create files belonging to a
> different user! You must at least be root if you expect to be able to
> do that.
>
> And what does scp do when you use -p (as root)?
>
Thanks for the reply.
Yes, that makes perfect sense. And unfortunately that may be the point
at which none of this will work. sshd_config is set to not allow root
to ssh. Security measure.
I suppose to could change it to allow root logon just for this, if
that's the only way around it.
I realize that without using root, there's no way to maintain ownership
and group settings.
>
> -p Preserves modification times, access times, and modes
> from the original file.
>
> Come to that, what happens when you use rsync -e ssh (as root)?
>
Yeah, I saw the -p in the tar man and tried it before I posted...and of
course because I'm using scp as non-root, it kept the permissions, but
set the ownership of the destination files to the user it's scp'ing
through.
Funny thing, I had guessed that was likely the case, not being root,
that prevented the ownership retention, yet, because it did copy files
over owned by root:root, I thought maybe there was a way to bypass the
problem.
rsync, interesting. The man for scp mentioned rcp, but with no man on
the server for rcp, I didn't know about rsync. Looks very useful!!
Again though, with root ssh login disabled, permission denied.
For just this server migration, since it looks like the only way to
copy 30GB over and keep all ownership has to be done through root, I'll
be reenablin the root ssh login.
> > I can't tarball the stuff
>
> Of course you can - you can tar it to stdout.
>
Didn't know that was an option. Looked at the man, and the reference to
stdout didn't indicate any hint at transferring to a remote server.
However, I figured this much out:
tar -czvf - foo | ssh (remoteserver) 'cd /foo/bar; tar -xzf -'
I tried with and without the --same-owner option, and still it converts
ownership to the user the ssh is going through.
I also tried, as root:
tar -czvf - ./* | ssh -l liam (remote server) 'cd /home/liam; tar -xzvf
-'
(with and without --same-owner)
Thinking the tar process would keep ownership but I can still bypass
the disabled root ssh login, but it still changed all ownership:group
to "liam" through which it was ssh'd.
> > because I only have 3GB left on the source
>
> Invalid reason.
>
> > What other options can I look into to copying that much data over, and
> > allowing it to keep owners and permissions?
>
> Use tar. This is standard stuff!
>
> Peter
Well, I'm going to read more about tar, but if I'm not mistaken,
there's likely no way around the ownership conversion if root isn't
being used for the ssh login. If I can't find any new info, way around,
I'll just enable root ssh login do it that way.
Thanks for the advice.
Liam
- Next message: Peter T. Breuer: "Re: restored partition with systemrescue, can't boot"
- Previous message: Robert Heller: "Re: Linux and Viruses"
- In reply to: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Next in thread: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Reply: Peter T. Breuer: "Re: copy server to server retaining chmod and ownership?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|