Tmp folder deleted?

Posted September 22, 2016 5.3k views

So i have a problem.

In order to free space from disk, i deleted my tmp folder, and then created another one. But when logging via ssh to my droplet, it promps this:

mktemp: failed to create file via template `/tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX’: Permission denied
ERROR: virtualenvwrapper could not create a temporary file name.

How do I solve this?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


You should verify permissions of your /tmp folder.
Execute following command, it will return information about permissions and ownership:

  • ls -ld /tmp

Default out should be that it have 1777 - drwxrwxrwt permissions and ownership is set to root:root.

ls -ld /tmp
drwxrwxrwt 11 root root 20480 Sep 22 09:35 /tmp

If this is not the case, two simple command could help you:

  • sudo chmod 1777 /tmp
  • sudo chown root:root /tmp

Permissions explained:
1 is sticky bit. When set, only owner of file can rename or delete it.
777 means that owner, group and everyone else can read, write and execute.
So adding sticky bit to 777 -> 1777 would ensure only you can remove/rename files which you are owner