Author Topic: [HELP] Rsync remove root as owner  (Read 1373 times)

blockcircuit03

  • Zen Apprentice
  • *
  • Posts: 25
  • Karma: +0/-0
    • View Profile
[HELP] Rsync remove root as owner
« on: November 23, 2016, 06:44:04 am »
Please help i just created an app that will automatically copy from directory A to directory B. This app running in ROOT permission and it execute the rsync command.

The problem is Directory A and Directory B have their different permission. So what i want is can i just use rsync to copy files but remove its original permission and adopt the permission of Directory B..


Ex.

Directory A: Owner:User1 Permission:rwxrwx
               

Directory B: Owner:User2 Permision:rwxrwxrwx


Executing rsync -avz will just copy files and change the file owner to root and permission with rwxrwx..

BerT666

  • Zen Warrior
  • ***
  • Posts: 228
  • Karma: +17/-0
    • View Profile
Re: [HELP] Rsync remove root as owner
« Reply #1 on: November 23, 2016, 08:52:55 am »
Howdy,

you could try to set the "SUID-Bit" and "SGID-Bit" according to your needs (but I have nerer tried this...).

Kind Regards

Thomas

blockcircuit03

  • Zen Apprentice
  • *
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: [HELP] Rsync remove root as owner
« Reply #2 on: November 23, 2016, 09:36:15 am »
Howdy,

you could try to set the "SUID-Bit" and "SGID-Bit" according to your needs (but I have nerer tried this...).

Kind Regards

Thomas

Can you please guide me on how to do that?

Edit;
I've done already what you said but it doesn't solve my problem.
« Last Edit: November 23, 2016, 10:38:03 am by RAAC »

BerT666

  • Zen Warrior
  • ***
  • Posts: 228
  • Karma: +17/-0
    • View Profile
Re: [HELP] Rsync remove root as owner
« Reply #3 on: November 23, 2016, 04:06:43 pm »
Hi,

I looked at the rsync parameters and fond something...

If you use -avz, the a represents (belong other options) keep user and group of the files!
Try to replace "rsync -avz" with "rsync -rlptvz". This should not keep the "original" permissions.
If there is still an issue, search the rsync parameters ;-)

Regards

Thomas