[Solved] Question re: setting up shared family storage

New to Debian (Or Linux in general)? Ask your questions here!

[Solved] Question re: setting up shared family storage

Postby FOSS-15-Great » 2020-04-19 11:38

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.
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

Re: Question re: setting up shared family storage

Postby CwF » 2020-04-19 23:58

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.
CwF
 
Posts: 721
Joined: 2018-06-20 15:16

Re: Question re: setting up shared family storage

Postby FOSS-15-Great » 2020-04-20 09:38

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!
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

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

Postby Head_on_a_Stick » 2020-04-20 12:36

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby FOSS-15-Great » 2020-04-20 19:26

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?
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

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

Postby Head_on_a_Stick » 2020-04-21 09:11

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby FOSS-15-Great » 2020-05-09 15:15

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.
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

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

Postby Head_on_a_Stick » 2020-05-09 16:30

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby FOSS-15-Great » 2020-05-13 09:55

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!
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

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

Postby Head_on_a_Stick » 2020-05-13 13:53

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby arzgi » 2020-05-13 14:16

FOSS-15-Great wrote:
Code: Select all
drwxrwsr-x  2 root shared 4096 May 13 09:00 shared



^ I think this.
arzgi
 
Posts: 638
Joined: 2008-02-21 17:03
Location: Finland

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

Postby Head_on_a_Stick » 2020-05-13 14:21

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby arzgi » 2020-05-13 14:45

Yes, those 's's, I rarely use them, thanks for correcting HOAS.
arzgi
 
Posts: 638
Joined: 2008-02-21 17:03
Location: Finland

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

Postby FOSS-15-Great » 2020-05-13 18:14

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
FOSS-15-Great
 
Posts: 32
Joined: 2020-04-18 08:11

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

Postby Head_on_a_Stick » 2020-05-13 18:21

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
User avatar
Head_on_a_Stick
 
Posts: 12320
Joined: 2014-06-01 17:46
Location: /dev/chair

Next

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable