[Solved] Question re: setting up shared family storage

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

[Solved] Question re: setting up shared family storage

#1 Post by FOSS-15-Great »

Hello Debian community,
I have another n00b question if I may:
I have installed and configured Buster on my T440p and everything is now running GREAT. I really like Gnome Desktop and Debian feels like such a solid choice of a distro - I am very chuffed by the prospect of using and learning it as the days go by.

This laptop will be used by various members of my family and my plan was to create a media type partition where all users could store and share with each other photos/videos (possibly documents) in a directory structure similar to a regular home folder but with rw access for everybody.

When I installed Buster I chose to encrypt my / partition not realising I would not be able to (easily) resize it later to create said storage partition. So my question is: what is the best practice example of setting up this shared directory and, more specifically, where should it be located? Reading up on the linux directory hierarchy I am unsure which directory to place it in. Presumably it won't be a user folder so /home isn't right. I was thinking about /var or /srv or possibly creating a "shared storage" folder in /.

I would then symlink that directory to all /home folders on the system.

Sorry if this is really basic but I would like to get this done correctly. Perhaps I may be overthinking this as well and would appreciate having that pointed out to me.

Thank you!
Last edited by FOSS-15-Great on 2020-04-20 09:38, edited 1 time in total.

CwF
Posts: 1093
Joined: 2018-06-20 15:16

Re: Question re: setting up shared family storage

#2 Post by CwF »

Create the shared directory in /home, as in /home/share. Then create a new user group to own that share, the 'share' group. Make each user a member of the share group and then will have access to the share directories. 'share' can be any name. Each use can navigate there or do links. A full directory tree can be in there, however you need it to appear.

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: Question re: setting up shared family storage

#3 Post by FOSS-15-Great »

CwF wrote:Create the shared directory in /home, as in /home/share. Then create a new user group to own that share, the 'share' group. Make each user a member of the share group and then will have access to the share directories. 'share' can be any name. Each use can navigate there or do links. A full directory tree can be in there, however you need it to appear.
Brilliant - thank you!

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#4 Post by Head_on_a_Stick »

If you want everybody to be able to edit files in that directory then you'll also have to apply the setgid bit and change the umask for your users.

See https://forum.mxlinux.org/viewtopic.php ... 34#p567834
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: [Solved] Question re: setting up shared family storage

#5 Post by FOSS-15-Great »

Head_on_a_Stick wrote:If you want everybody to be able to edit files in that directory then you'll also have to apply the setgid bit and change the umask for your users.

See https://forum.mxlinux.org/viewtopic.php ... 34#p567834
Brilliant, thank you. None of my users (including me) have a ~/.xsessionrc file. If I add one at the ~/ location is it enough to add the line you mentioned in the linked forum post? Seeing that I use GDM do I need to configure it at all?

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#6 Post by Head_on_a_Stick »

If you're using GNOME then just un-comment & edit the umask line in ~/.profile.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: [Solved] Question re: setting up shared family storage

#7 Post by FOSS-15-Great »

Just double-checking this after re-reading your previous post (and the linked on on the MX Linux forum):

Should the uncommented line in ~/.profile say 022 (the default entry) or should it be edited to 002 (as in the post you linked to on the MX Linuz forum.

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#8 Post by Head_on_a_Stick »

FOSS-15-Great wrote:should it be edited to 002
^ This. Read the umask(2) man page to find out what that means.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: [Solved] Question re: setting up shared family storage

#9 Post by FOSS-15-Great »

Head_on_a_Stick wrote:
FOSS-15-Great wrote:should it be edited to 002
^ This. Read the umask(2) man page to find out what that means.
Thank you - I have been reading up on umask and chmod
Unfortunately, the setup is not working as it is supposed to.
These are the steps I have taken:
  1. su - root and create directory 'shared' in /home
  2. Code: Select all

    groupadd shared
    chgrp -R shared /home/shared
    chmod -R g+ws /home/shared
  3. added users to group shared
  4. edited and uncommented

    Code: Select all

    umask 002
    in ~/.profile for all users
The resulting directory looks like this:

Code: Select all

drwxrwsr-x  2 root shared 4096 May 13 09:00 shared
However, whenever a file is created by any user it will be read-only to the other users.

So I set

Code: Select all

chmod775
for /home/shared but that makes no difference.

When I type

Code: Select all

umask
in a terminal window the result is

Code: Select all

0022
which is baffling. Does that mean that
  1. I should be editing ~/.profile to 0002
  2. or that the umask entry is read from a place other than ~/.profile?
Many thanks for your continued help with this problem - apparently trivial but enough to trip me up!

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#10 Post by Head_on_a_Stick »

I've just tested my suggestions (again) with a new user & the GNOME desktop and it all works as it should. No idea why you're having problems.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

arzgi
Posts: 793
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 2 times

Re: [Solved] Question re: setting up shared family storage

#11 Post by arzgi »

FOSS-15-Great wrote:

Code: Select all

drwxrwsr-x  2 root shared 4096 May 13 09:00 shared
^ I think this.

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#12 Post by Head_on_a_Stick »

Code: Select all

empty@E485 ~ % ls -ld /home/shared
drwxrwsr-x 2 root shared 6 May 13 15:40 /home/shared
empty@E485 ~ %
^ That works for me.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

arzgi
Posts: 793
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 2 times

Re: [Solved] Question re: setting up shared family storage

#13 Post by arzgi »

Yes, those 's's, I rarely use them, thanks for correcting HOAS.

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: [Solved] Question re: setting up shared family storage

#14 Post by FOSS-15-Great »

arzgi wrote:^ I think this.
Head_on_a_Stick wrote:^ That works for me.
arzgi wrote: Yes, those 's's, I rarely use them, thanks for correcting HOAS.
I am not following, sorry. Do you mean the "s" in rws?

I am still struggling to understand why this isn't working.
the shared folder has permissions and gid set correctly but when I create, save or copy a file into the directory the folder's permissions aren't applied to the files inside. Is this a problem of umask?
I am using GDM on X11 (I installed NVIDIA drivers on Optimus laptop and GDM automatically switched from Wayland to X11).
Here is what my .profile looks like:

Code: Select all

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
umask 002

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Solved] Question re: setting up shared family storage

#15 Post by Head_on_a_Stick »

FOSS-15-Great wrote:Is this a problem of umask?
Yes, my suggestion won't work unless the umask is set to 002. Both the X & Wayland sessions for GNOME obey ~/.profile in my Debian buster box but if you're using the X session then you can try adding the umask line to ~/.xsessionrc instead.

/etc/pam.d/login can also set the default umask but that doesn't work for me.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

FOSS-15-Great
Posts: 33
Joined: 2020-04-18 08:11

Re: [Solved] Question re: setting up shared family storage

#16 Post by FOSS-15-Great »

Head_on_a_Stick wrote:Yes, my suggestion won't work unless the umask is set to 002. Both the X & Wayland sessions for GNOME obey ~/.profile in my Debian buster box but if you're using the X session then you can try adding the umask line to ~/.xsessionrc instead.
Thank you for clearing that up. I edited ~/.bachrc according to the Debain user manual and now the umask setting for every user shows correctly as

Code: Select all

umask 0002
.
However, the problem persisted across multiple logins and logouts. Eventually I rebooted the machine and at the next login the permissions were set correctly. I still have to figure out why my ~/.profile umask entry was not being obeyed but I will leave that for another day.
:?

Post Reply