User accounts accessing each other's public folder

Hi, I have installed two new accounts. The system creates a “public” folder for both of them, but these folders don’t seem to be really public. If user “A” saves a file into her public folder, user “B” cannot see that file in his public folder and vice versa. What am I doing wrong?

1 Like

Hi, @rowerner and welcome to the Ubuntu MATE Community!

Welcome to the Ubuntu MATE community!

Offhand, I'd guess your umask setting is off. You can check /etc/profile to see how it's set (if at all). However, the easiest approach to take now that the accounts have been created is to just change permissions on the /home//Public folder to make it "world readable."

However, the umask setting for the user creating the file will ultimately determine whether a file created in that folder is viewable. You may need to change the umask value in the user's .profile or .bashrc depending on which is used.

umask is a bit complicated to describe. You might check out this Wikipedia article for a better understanding: umask - Wikipedia

1 Like

If you right click on Public folder, Properties, Access Control List you can enable R/W actions with other users.

1 Like

First, 'public' folders in Ubuntu are about network sharing. More on that is written below.

Years ago I found out that Ubuntu accounts allowed mutual read access for local users' home folders by default. Not sure if they have changed that recently. To find out you may want check and change actual folders' permissions and/or defaults like previous posts suggested.

1 Like

permissions for the home dir used to be 755 but realized that userB could access userA's files so permissions were changed to 750 so that userB cannot even 'look into' userA's dir.

BEFORE: drwxr-xr-x 27 user user 4096 Nov 15 05:25 user/
AFTER: drwxr-x--- 36 user user 4096 Nov 15 05:26 user/

1 Like

The only true way to share files, without exposing your individual HOME contents, is to set up the "Public" folders under their own tree, on the same partition that the users reside, to avoid issues from using the "mv" command.

###
###   NOTE:  "chmod 755"  will permit users to 
###   * see the directories, 
###   * navigate into them, and
###   * will NOT allow delete of those files.
###   
###   What users can do with those individual
###   files is controlled by the priviliges on
###   the individual files.
###

sudo mkdir   /home/public
sudo chown   root:root   /home/public
sudo chmod   755         /home/public
###   Only root can create/delete directories under /home/public

sudo mkdir   /home/public/${user1}
sudo chown   ${user1}:${user1_group}   /home/public/${user1}
sudo chmod   755         /home/public/${user1}
###   Only ${user1} can create/delete files from /home/public/${user1}

sudo mkdir   /home/public/${user2}
sudo chown   ${user2}:${user2_group}   /home/public/${user2}
sudo chmod   755         /home/public/${user2}
###   Only ${user2} can create/delete files from /home/public/${user2}

###
###   If ${HOME}/Public directories exist, 
###   you will need to run the commands 
###   preceded by the commenting "#".
###

###
###   Performed by ${user1}
###

# mv    /home/${user1}/Public      /home/${user1}/Public_tmp
ln -s   /home/public/${user1}    /home/${user1}/Public
# mv -pv   /home/${user1}/Public_tmp/*      /home/public/${user1}
# rmdir -v /home/${user1}/Public_tmp

###
###   Performed by ${user2}
###

# mv    /home/${user2}/Public      /home/${user2}/Public_tmp
ln -s   /home/public/${user2}    /home/${user2}/Public
# mv -pv   /home/${user2}/Public_tmp/*      /home/public/${user2}
# rmdir -v   /home/${user2}/Public_tmp

For each instance of shared user group ( i.e. ${user1_group} is same as ${user2_group}, you can restrict to only that group by changing the privilege of each impacted folder under /home/public with the following:

sudo chmod   750   /home/public/${affected_directory}

:slight_smile:

1 Like

Thank you all for your help. After 50 years of cp/m, msdos and win I have to unlearn a lot to start with Linux. :face_with_raised_eyebrow:

2 Likes

WOW! Haven't seen mention of that one for almost 30 years! I'm 70, and I just couldn't get into it so MS-DOS was the one that got me on the IT journey along with Turbo Pascal. :slight_smile:

2 Likes