LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-08-2016, 07:16 PM   #16
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163

You need to run the command as root. If you do it with any other person, all files will be created with that account. Only root has the ability to change the ownership of a file.
 
Old 09-08-2016, 07:20 PM   #17
lq_win
Member
 
Registered: Jul 2015
Posts: 46

Original Poster
Rep: Reputation: Disabled
I ran it using root.
 
Old 09-08-2016, 08:02 PM   #18
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
What is the destination file system? Is it a network file share of some sort? Depending on the destination file system and possibly folder settings, there may be something that is overriding root's normal local capabilities.

For example, if you are using sshfs, the abilities will be limited to the abilities of the login used to mount the share.
 
Old 09-08-2016, 08:43 PM   #19
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Something curiously maps ownership in your target directory to the guest user...
Could you tell more about target directory, is it a mounted directory from network, if yes what protocol?

edit, yes as @IsaacKuo says... Sorry didn't read the posts on page 2

Last edited by keefaz; 09-08-2016 at 08:45 PM.
 
Old 09-08-2016, 09:28 PM   #20
lq_win
Member
 
Registered: Jul 2015
Posts: 46

Original Poster
Rep: Reputation: Disabled
Hello All,

The problem is resolved now..
rsync -rtvua /home2/user1/ /home3/user1.backup
I made something stupid there .. (sorry .. to make all of you confusing)

thanks...

but now I want to rsync /home3/user1/backup to another server via ssh..
ssh-keygen was created and I was able to login

I ran command below:

rsync -rtvua /home3/user1.backup guest@backup.mydomain.co.id:/backup/VIP/10.100.100.50

all ownership become 'guest' ?

what I missed?
 
Old 09-08-2016, 09:44 PM   #21
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by lq_win View Post
rsync -rtvua /home3/user1.backup guest@backup.mydomain.co.id:/backup/VIP/10.100.100.50

all ownership become 'guest' ?

what I missed?
As already noted, if you use a regular user, such as guest, all files created will be owned by that user. Root is the only user which can change ownership of a file.

Your command explicitly uses the userid "guest" to log into backup.mydomain.co.id.
 
Old 09-08-2016, 10:12 PM   #22
lq_win
Member
 
Registered: Jul 2015
Posts: 46

Original Poster
Rep: Reputation: Disabled
Hi IsaacKuo,

you are right!..

if I tried to rsync specific user it run correctly (the ownership preserved)

rsync -rtvuaz /home3/user1.backup root@backup.mydomain.co.id:/backup/VIP/10.100.100.50 --> this will preserved ownership for user1

but if I run:

rsync -rtvuaz /home3 root@backup.mydomain.co.id:/backup/VIP/10.100.100.50 --> all folders owned by root..
or
rsync -rtvuaz /home3/* root@backup.mydomain.co.id:/backup/VIP/10.100.100.50 --> all folders owned by root..

what wrong?
 
Old 09-08-2016, 11:14 PM   #23
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 306

Rep: Reputation: 121Reputation: 121
Did you get any error messages?
 
Old 09-09-2016, 11:17 AM   #24
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Do you know for sure which remote shell the rsync command is using? I personally do not use rsync in this fashion, so I can't be certain ... I think by default the way you state it an unencrypted connection is used. Probably not a good idea, since I'm guessing this data is being transferred over the internet (as you seem to be using a fully qualified domain name).

In any case, the remote shell you are using may not be properly configured to provide root with full access rights. The usual thing, I think, is to use "-e ssh" to specify ssh shell - for the sake of encryption and security. You'll have to configure ssh to allow root login, of course, and for security's sake you'll likely want to disallow password login (only allowing key based authentication).

Finally, it is still possible there is something funny about the destination file system or parent folder properties. You have not said anything about the destination file system or the parent folder properties yet.
 
Old 09-09-2016, 11:26 AM   #25
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by IsaacKuo View Post
Do you know for sure which remote shell the rsync command is using? I personally do not use rsync in this fashion, so I can't be certain ... I think by default the way you state it an unencrypted connection is used. Probably not a good idea, since I'm guessing this data is being transferred over the internet (as you seem to be using a fully qualified domain name).

In any case, the remote shell you are using may not be properly configured to provide root with full access rights. The usual thing, I think, is to use "-e ssh" to specify ssh shell - for the sake of encryption and security. You'll have to configure ssh to allow root login, of course, and for security's sake you'll likely want to disallow password login (only allowing key based authentication).

Finally, it is still possible there is something funny about the destination file system or parent folder properties. You have not said anything about the destination file system or the parent folder properties yet.
rsync uses ssh by default, "-e ssh" is redundant.
 
1 members found this post helpful.
Old 09-09-2016, 06:54 PM   #26
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,324
Blog Entries: 1

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
# rsync -aRXHv ./* /mnt/clone/

When I'm cloning a linux install (that's not currently being used). While in the / of the install to be cloned. $(cd /mnt/original/)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync - permission denied (13) on Centos 6.5 - even when run as root Kernel Fergus Linux - Server 3 03-06-2014 10:54 AM
File & Folder Permission and Ownership permission error in Cloud storage. rhcekumaran Linux - Newbie 3 06-14-2013 05:41 AM
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 09:34 AM
rsync not preserving owner and group graziano1968 Linux - Server 6 09-10-2008 08:52 AM
Preserving date and ownership when untar ? talat Linux - Software 1 02-09-2006 05:07 PM


All times are GMT -5. The time now is 02:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration