View Full Version : [ubuntu] different umask for folders and files

May 24th, 2010, 07:48 AM
Hello together,

I have ubuntu installed on my computer and want to give the following default rights to one user on the filesystem:


and for folders:


I think I have to use umask for this, but I don't know how to specify whether I configure the umask for files or for folders ?

Maybe I don't have to use the umask - command for this ?

Many thanks for your help,

Best regards,

May 24th, 2010, 07:52 AM
man umask

May 24th, 2010, 07:57 AM
Hi jbrown96 (http://ubuntuforums.org/member.php?u=304717).

Many thanks for this help. But I tried this out yet, and I could not find the solution.

That's the reason why I posted this question in this forum.

Are you sure you have found the solution by using

man umask

or even

man 2 umask ???


May 24th, 2010, 08:14 AM

You can change it like this.
chmod u=rw,g=rx,o= files

Are you looking for this?

May 24th, 2010, 08:21 AM
I don't know how to set the umask for a single user, but I know how to do it for all users.

Edit: /etc/profile

On the very last line there it should say the following by default:

umask 022

To have all newly created files and folders have permissions of rw-r----- and rwxr-x--- you will want to change the umask to

umask 027

Save the file, reboot, and you should be good.

However this will only change new files and folders that are created. Everything else will still probably be as it was before.

I hope this helps!

May 24th, 2010, 08:21 AM
Sorry, but this doesn't work too:

chmod: Ungültiger Modus: „u=rw,“
„chmod --help“ gibt weitere Informationen.

Sorry my system is in german, but as you can see, the mode u=rw is not recognized.

May 24th, 2010, 08:24 AM
sorry, I changed it
chmod u=rw,g=rx,o= files

May 24th, 2010, 08:25 AM
Thank you Lucky, this worked fine.

You only have to write umask 027 in command line and the umask is set for this session.

Thanks again.

Problem solved, now I have to try to understand why it worked like this ;-)

May 24th, 2010, 08:27 AM
For a single user, I think you have to put the mask in the file


in it's home directory


May 24th, 2010, 09:11 AM
For a single user, I think you have to put the mask in the file


Thanks csyoen, I will try that out!

May 24th, 2010, 09:24 AM
Single user -R