0775
is rarely correct for a file. The following will add the appropriate desired permissions to the appropriate type, without disturbing other existing permissions:
find somedir \( -type d -exec chmod u+rwx,g+rwx,o+rx {} \; -o -type f -exec chmod u+rw,g+rw,o+r {} \; \)
See the man page for find to help decipher that.
You can use an ACL (access control list) to set the default permissions for files in a directory.
From man 5 acl
:
If a default ACL is associated with a directory, the mode parameter to
the functions creating file objects and the default ACL of the directory
are used to determine the ACL of the new object:
The new object inherits the default ACL of the containing directory
as its access ACL.
The access ACL entries corresponding to the file permission bits are
modified so that they contain no permissions that are not contained
in the permissions specified by the mode parameter.
To set it up (change device, directories, etc., accordingly):
Edit your /etc/fstab
file and add the acl
mount option.
/dev/mapper/star-home /home ext3 defaults,acl 0 2
Remount (Samba mount.cifs
man page) your filesystem by rebooting or use:
mount -o remount,acl /home
Make sure you have the setfacl
and getfacl
utilities.
Set the default ACL on the directory (you may also need to set the ACL on existing files):
$ setfacl -m d:user:george:rwx,d:group:sales-g:rwx,d:group:marketing-g:rwx projections
See the linked tutorial for more information.
Source: Tutorial Part 1 and Part 2
Reference: POSIX Access Control Lists on Linux
Best Answer
The setting you're looking for is called the
umask
, and that's also the name of the command that changes it. To make a persistent change, add aumask
command to your shell startup file -- probably named.profile
or.bash_profile
, in your home directory; if you don't seem to have any such file, post the output of these commands: