Reset User's Home Folder Permissions - SOLVED

sharedfolders

(Paolo Fornara) #1

Hi there,

Is there any method (maybe throught shell ?) to reset user home folder permissions as done for shared folders on gui ?

Actually I’m trying to migrate our company old samba server to a new one with NS7…but when I rsync “old” home directories to new ones, with rsync -a /source /dest, rsync keeps original (old server) owner & group membership.

On the other hand, without the -a flag, rsync set owner and group to root:root and also this is not correct in my scenario.

I would like something to reset home folder permission (and its contents) for a particular user. Otherwise I need everytime to do something like :

find . -type d -exec chmod 770 {} +
find . -type f -exec chmod 660 {} +

and then issue a “chown -R new_user@XXXXXX:domain users@XXXXXX” against new home folder.

Any shortcut ?

Let me know

Finest Regards

Paolo


(Rob Bosch) #2

Maybe you can add the chmod command to your rsync command: https://askubuntu.com/questions/32552/forceably-set-permissions-when-running-rsync

from rsync manpage:

To give new files the destination-default permissions (while leaving existing files unchanged), make sure that the --perms option is off and use --chmod=ugo=rwX (which ensures that all non-masked bits get enabled).


(Paolo Fornara) #3

Rob, thank you for your reply.

It seems to me the only way to achive what I want. Unfortunately on rsync you can only set chmod permissions to whatever but no (destination) owner and group…thank you so much again


(Paolo Fornara) #4

Dear all,

finally got it:

NS7.4 comes with rsync 3.0.9 on default install.

Unfortunately this version (it’s quite old) lacks some interesting features like : quick chmodding with bitmask like chmod=D770,F660 or chowning target files like chown=user:group (this is the quick way and syntax to map local to remote user/group).

So I needed to upgrade rsync from external repo:

  1. rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-10.gf.el7.noarch.rpm
  2. yum install -y --enablerepo=gf-plus rsync
  3. yum remove -y gf-release (just to be sure that this repo will not break any dep or installed package)

next this is the way I synced remote smb repository to my NS shares :

rsync --chmod=D770,F660 -rptlvog --chown=“root:domain users@mydomain.it” /mnt/remote_files_share /var/lib/nethserver/ibay/local_files_share


(Michael Träumner) #5

Thanks for your description how you solved it.
Could you please mark it as solved at the following way: