Skip to content
Advertisement

Permissions for external drive with different users [closed]

Problem:

I need to use an external drive (encrypted ext4) to share files between two different Ubuntu 16.04 machines (home and work).

However, the machines also have different user name account logins (“home”, “work”).

I cannot figure out how to give both accounts access to files created by both accounts.

Code run:

I ran the nuclear option from the work account (below), which I thought would achieve this, but I still don’t have permission to access directories created by the work machine, on the home machine.

sudo chown -R $USER /media/$USER/SSD-1TB
sudo chmod -R 0777 /media/$USER/SSD-1TB

Desired outcome:

Read/write permissions on an external drive for any user account from any Ubuntu machine that I plug it into.

Thanks!

Advertisement

Answer

Check your umask value. More info: https://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

umask is used for setting the default file permissions. The issue with your above approach is that you have updated existing files with 0777 but new files get created with the default. I recommend you update both “work” and “home” users to use the same primary group then you can set umask 002 which will cause the new files to be written with 0664 and therefore they will be writable/readable by the group on both machines.

Advertisement