/tmp folder has all permission:

drwxrwxrwt 28 root root 20480 Jan 24 03:14 /tmp

File /tmp/test.txt already exists, with permission 666, owned by user test1.

-rw-rw-rw- 1 test1 test1 0 Jan 24 02:34 /tmp/test.txt

As user test2, I run echo hello >> /tmp/test.txt

bash: /tmp/test.txt: Permission denied

Even when I switch to root, I still can't append to that file. It seems like only the owner of the files in /tmp can modify its content regardless of the permission bit.

Virtualization: vmware
Operating System: Ubuntu 20.04.3 LTS
Kernel: Linux 5.13.0-27-generic
Architecture: x86-64

  • Check the file system: mount, df Jan 23, 2022 at 21:36
  • How is the filesystem mounted? Is it part of the host? What happens if the owning user runs the command? Jan 23, 2022 at 21:39
  • @ctrl-alt-delor the owner runs it fine. The filesystem is mounted normally, I believe. Everything is under /
    – vcth4nh
    Jan 24, 2022 at 3:40
  • @GerardH.Pille should I type those commands and paste the result here?
    – vcth4nh
    Jan 24, 2022 at 3:43
  • @vcth4nh no, leave it, I've no experience with vmware. Jan 24, 2022 at 5:59

1 Answer 1


To anyone having the same problem in the future, /tmp is a sticky folder by default, meaning only the file owner can modify it. Therefore, to change others' files, you must remove the sticky bit: sudo chmod -t /tmp. Note that you should turn it back on afterward: sudo chmod +t /tmp.

As suggested in comments, a better solution is that you can also create a new folder in /tmp to do the trick without touching the permissions on /tmp.

  • 1
    Doing this on a multi-user system would be less than ideal. Instead, create a directory under /tmp and do the whatever you need to do in there, without touching the permissions on /tmp.
    – Kusalananda
    Jan 24, 2022 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .