Linux – Set your home folder default permissions (umask)

When you create a file or directory under Linux, the file/directory will have a default set of permissions.

Usually the system defaults may be less then secure. For example, if a text file has 666 permissions, it grants read and write permission to everyone, or, if a directory has 777 permissions, grants read, write, and execute permission to everyone.

If you need more security/privacy in your home folder, you can set up the default permissions by editing the .profile or the .bashrc files with your favorite text editor.

After opening the file, look for something like umask 022 (it may be commented out with the # sign), and change the value for umask 077.

If you want to play around with permissions, here’s what you need to have in mind.

In *nix systems the permissions are always set for user, group and others, so if you set your umask to 077 you will end up with the following permissions:

Owner – Read, Write, Execute

Group – No Permissions

Others – No Permissions

Here’s a little guide for octal permissions in *nix.

Octal value : Permission

0 : read, write and execute

1 : read and write

2 : read and execute

3 : read only

4 : write and execute

5 : write only

6 : execute only

7 : no permissions

 

Leave a Reply

Your email address will not be published. Required fields are marked *