Reset User's Home Folder Permissions - SOLVED

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


Maybe you can add the chmod command to your rsync command: server - Forceably set permissions when running rsync - Ask Ubuntu

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).

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

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
  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” /mnt/remote_files_share /var/lib/nethserver/ibay/local_files_share


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