Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog. You can find information on programming, linux, documentation, tips for code and database optimization, my thoughts and rants, and whatever else I feel like sharing. Feel free to contribute to the blog by posting comments and asking questions.
Linux

linux i discovered umask and sgid for default file/directory permissions

I’ve known for a while that there is a way to set the default group ownership and rwx permissions of files in a directory, but I’ve been content with changing files permission levels on an as needed basis until today.

To set the default file permissions in a directory:
umask 775 /path/to/dir

To set the default group ownership:
chmod g+s /path/to/dir

Here is a good article on file permissions in linux: http://www.linuxforums.org/security/file_permissions.html

Related posts:

  1. Get active directory ldap attributes from the command line with ldifde
  2. setting up samba on debian 3.1
  3. setup an easy ftp server on debian 3.1 linux
  4. setting up ssl for apache2 on debian linux
  5. linux using the cat command to append files together

One Response to “linux i discovered umask and sgid for default file/directory permissions”

  1. Sobachatina says:

    Your first command is incorrect:
    umask 775 /path/to/dir

    This will not change the default permissions for files created in the directory. The path to the directory will be ignored and this will change the default permissions for all files created during that session regardless of where they are created.

Leave a Reply