0

I have an SSD (256gb) with two partitions, one of the with Ubuntu. I also have an HDD with /home and a partition for data (music, videos, etc). I would like to move /tmp (on the ssd) to /home (on the hdd). So far I have only found one answer saying that the way to do this is:

mv /tmp ~/tmp
ln -s ~/tmp /tmp

Would this actually work? Shouldn't I also change something in /etc/fstab? Thanks

Private
  • 4,074
aripod
  • 1
  • 3

1 Answers1

0

It would, but you would also need to do some more things. The default permissions of /tmp are this:

# stat /tmp
...
Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (    0/    root)

Since the permissions of the link are the permissions of the target, you will have to change the permissions of ~/tmp. At the least, it should be world-readable and -writable:

chmod a+rwx ~/tmp

The t bit should also be set (see What is the "t" letter in the output of "ls -ld /tmp"?):

chmod +t ~/tmp

There might be other problems. If any directory in the path for ~/tmp doesn't have execute bit set for others, this folder will be inaccessible for most users.

I missed the obvious flaw in this:

Any attempt to use /tmp before your home directory is available will fail.

This might be one place where bind mounts are better than links.

muru
  • 207,228