What is umask?
umask? What?
What is umask command use for in linux/unix system?
umask is uses to set the default file or directory permission when a user create a new file or directory. By default, when a user created new file/directory, the default permission is 644/755 or umask 022, that is the default umask configure in the your unix/linux system.
umask calculation
How does the umask calculation works? Simple, subtract the default value of file value (666) and directory value (777) to the permission mode you wanted. In an example, I would like a new files/directory create with owner (Read/Write/Execute), group (read), others (read), the umask value would be umask 022.
If you want the permit an unix user created the file with default permission 600, set the umask to 066 in the default shell config file.
Test with umask
Setting the umask to 066 and see what will happen.
shell> umask 066
shell> mkdir foo
shell> ls -dl foo
drwx--x--x 2 takizo takizo 68B May 21 08:57 foo
the directory is created with permission mod 711
shell> touch bar
shell> ls -l bar
-rw------- 1 takizo takizo 0B May 21 09:00 bar
the file is create with permission mod 600
Related posts:
- installing postgresql 8.2 on Leopard with macports postgresql! one of my favorite high performance open source db,...
- MySQL 5 Server Cannot Start on Apple Mac Leopard There were some problem during configuring MySQL5 Server on Leopard...
- Install and Configure mod_suphp or suphp on Plesk Server Plesk control panel comes with Media Temple DV package doesn’t...
- How to Create User with useradd in FreeBSD You can invoke “adduser” command in FreeBSD in order to...
- Configure Your Own screenrc file There are few shell scripts I need to run when...
- TextMate: Creating New Project in Shell Instantly Been using TextMate recently, really loving it like hell. There...
- Linux/Unix Search and Replace Text from Multiple Files In Linux/Unix, for newbie to do search text from multiple...
- Microsoft Windows 2000 – Problem Starting Computer Management Console When are you having problem to start up Computer Management...
- How To Generate a Certificate Signing Request (CSR) for an SSL Certificate This short tutorial is for Apache2.x + OpenSSL It’s advice...
- Quick File Copy on File Name with Sample Extension By default, some of the application installation provide you a...