On Ubuntu 18, I have mounted an external drive in /mnt/hdd/ and then I have changed its permission with sudo chmod 777 /mnt/hdd/. In this way, all users can write in this external HDD. However, in this way, if user A creates a folder, then user B can delete the folder created by user A. How can I avoid this? Ideally, every user should be able to write to /mnt/hdd/, but only the user that creates its folder should be able to write/delete it.


  • Don't use 777. Use chmod and set the owner and group accordingly.
    – Panki
    Oct 21 '19 at 14:17

You should do:

sudo chmod 1777 /mnt/hdd

That's how /tmp works.

  • 1
    By the way, this is called the "sticky bit". It is also represented by T.
    – Hermann
    Oct 21 '19 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.