Accidentally deleted tmp folder
Solution 1:
I can't think of a reason why this shouldn't work. On my system, the permissions are set by:
sudo chmod 1777 /tmp
(drwxrwxrwxt)
Solution 2:
You should run the following commands to restore the tmp folder.
sudo -i
# You now have a root prompt and do not need to continue typing sudo
mkdir /tmp
chmod 1777 /tmp
exit
Then you sould be all good
Solution 3:
To add to Alex's answer, you can do both those commands at the same time using the -m
or --mode
option for mkdir(1), which specifies the mode for the created directory:
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
So the command would be:
sudo mkdir -m 1777 /tmp