UNIX / Linux : What is the correct permission of /tmp and /var/tmp directories

What are the correct permissions required for the /tmp and /var/tmp directories?

Answer

The /tmp and /var/tmp directories requires special permissions. This directory has Sticky Bit permissions. Many applications will show errors or fail if they are not able to write to /tmp with the appropriate permissions.

# ls -ld /tmp
drwxrwxrwt 21 root root 12288 Apr 28 16:18 /tmp

The ‘t’ at the end symbolizes that the sticky bit is set. A file created in the /tmp directory can only be removed by its owner, or the root user.

Setting up the permissions

Change the permissions on the directory by running either the following commands:

# chmod 1777 /tmp

or

# chmod a+trwx /tmp
Related Post