The umask enviromental variable sets the file permission for all files and directories in Linux and Unix operating systems. The variable works as a mask, and subtracts execute, write and read permissions from specified files and directories. The default permissions are 666 -- read and write for all users -- for files, and 777 -- read, write, execute for all users -- for directories. Since the default values are inherently insecure, use the umask variable to create a more secure environment.
Open a Terminal window. Type the command umask to determine the umask value, which is usually around “022."
Subtract the umask value from “666” for files and “777” for directories. For instance:
666 - 022 = 644
777 - 022 = 755
Determine the file permissions from the resulting values. The values are based on the octal code for permissions which are “4” for read permissions, “2” for write permissions and “1” for execute permissions. The value “644” for files gives the owner of the file read and write permissions while the group and others have only read permissions. The value 755 gives the owner of the directory read, write and execute permissions while the group and others have only read and execute permissions.
Type exit to close the terminal session.
Tips & Warnings
- The "chmod" command overrides the values for umask files and directories.
How to Create Custom Commands in FileZilla
FileZilla is a free FTP client and server application. Use it to transfer files from one computer to another in client or...
How to Make Scary, Disgusting Halloween Masks
Halloween is not just for kids anymore. Adult costumes and masks are more over-the-top every year, with frightening masks and bloody clothing...
How to Change a Js Variable From an Address Bar
How to Unmask a Restricted Caller ID
Similar to landlines, cellphones are equipped with Caller ID capability. Essentially, when someone calls you, the phone displays the person's phone number....
PHP Mkdir Permission Does Not Work
PHP provides a function called "mkdir" that lets you create a new directory. An optional argument specifies the numeric value of the...
Computer Modem Troubleshooting Code 777
Connecting to an online service's network using a modem can sometimes be difficult. Errors and problems do occur, such as the modem...