Ubuntu – Permanently set file and folder permission for a user


I just got hold of a Linux machine running Ubuntu from my friend. It places 644 permission on all new files created by a user.

But for some purposes I want 755 permission on all files and folder created by that user, I have been searching on Internet from all day long but did not got hold of any useful resources plus I am a beginner to Linux system as well.

Best Answer

  • In the .profile of that user or in the global /etc/profile, put

    umask 027

    Note to self: to get the umask, subtract the desired directory octal permissions from 777, so in that case 777-750 becomes 027. This should give drwxr-x---.

    With that umask, the file creation mask will be 666-027 = 640 (note that this is not real subtraction, you subtract digit by digit); this will give -rw-r-----.

    In short: you can read, write and change into directories; group can read and change into directories; anyone else is blocked. Is that correct?