File permission umask howto?

Martin Pool mbp at samba.org
Tue Apr 2 11:27:55 EST 2002


On 30 Mar 2002, Diburim <diburim at hotmail.com> wrote:
> I'm trying to figure out how to cause rsync to
> create the file on the backup server with 700 permission
> and specific owner "some_user" (not root)
> 
> I try to do it in several way with no success.
> 
> The command I'm using is:
> rsync -r -t -v -z /dir some_user at server::module
> so that it don't copy permission
> 
> It always give the files 744 permission, that mean that every on can read
> the file !
> I want it to be 700. 
> 
> I try to change the umask command in /root/.bashrc and ~some_user/./.bashrc
> to 
> umask 077 but it didn't help

.bashrc is only executed for "interactive shells".  When sshd on the
destination machine launches bash to start rsync --server it does not
start an interactive shell.  There is a long explanation in the Bash
manual which I will not repeat here of the various types of
"interactive" and "login" shells, and which dot files they run.

On some systems /etc/profile will invoke ~/.profile, so you may be
able to put the command in their.

A simple way to fix it would be to just change the permissions on the
local file, making a copy if necessary, and then copy then with
--perms.  Unless the files are so large as to make this impractical
that's probably the way I would do it.

We've talked about a --chmod option to modify the permissions in
flight, but nobody has written it yet.

Hope that helps,
-- 
Martin 




More information about the rsync mailing list