[SOLVED] Mounting Shared Partition Woes (newbie)

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

[SOLVED] Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

Hi Folks,

Complete linux noob here. I’d post this in the newbie forum but for the topic. Also, as a windows refugee I may use MS terminology (for which I apologize in advance) to describe what I’m attempting to do.

What I want, is to be able to mount additional physical drives and/or partitions so that everyone has full access to everything on them. This could be internal to the computer, plugged in via esata (like my mobius raid box), or a NAS drive stashed away on a shelf.

Running LM19.1

3 internal physical drives (sda, sdb, sdc):
  • OS with home folders
    Shared data (to primarily be used for VM files)
    Shared data (user files, music, graphics, ebooks, etc)
3 user accounts (1 admin, 2 std) – all are me. The 2 std accounts can be thought of as “home” and “work”. And I do have a tendency to create additional users on a per project basis for convenience, so obviously this would apply going forward.

Given this operating scheme, I have learned over the years to never actually store anything such as documents, etc. in my “user profile”. My secondary drive has always been organized the way I want, regardless of how the OS wants to manage the profile. Even my browser profiles are placed where I want them (rather than the defaults). I even set up symbolic links to force programs to play by my rules rather than the MS ones (or even the dev's rules).

[deep breath, “I am NOT a control freak”, repeat 10x, ok that’s better…]

This lets me pull up a document, play a song, whatever, regardless of what account I’m logged in as. Obviously on a system or network shared with multiple people this would have to be modified. I don’t have to worry about that.

Now based upon what I’ve read here in the forum and on the community tutorial pages the process is as follows, correct?
  • Create a Mount Point for each shared partition
    • Where? Does it matter (mnt, media, somewhere else)?
    Set the permissions on the Mount Point (??)
    • Can I just set permissions on the partition and let it go at that?
      Or do I have to create a custom security group and assign every account to this?
      Does that new group “own” the mount point?
      Can I do it once and forget it, or do I have to manually add every account to that group? I'm assuming there's a way to auto add a group membership to every new account created.
    Go have fun
Can I do this in the Disc Util? Or do I have to manually edit the fstab file? Do I need something other than the standard LM 19.1 install?

Sorry for the long winded question. Thanks for the help in advance. One of these days I'll be able to pay back. Right now I just want to get up and running.

SomeDude
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
athi

Re: Mounting Shared Partition Woes (newbie)

Post by athi »

Just setup my new PC with similar setup except for single user account on the PC. Steps I used to setup additional drives:

Step to add additional data HDD to /home folder:
Install HDD and format to ext4 using Gparted or Disks
Create mount point for partition
optional - $ whoami (list user name)
$ sudo mkdir /home/user/xxxx (create xxxx folder in /home/user folder)
Repeat for all data partitions
Edit /etc/fstab file using Disks (editing fstab is a bit of a pain and prone to user error)
open Control Center-Disks
select drive at left panel of Disks window
click on Additional partition options icon (gears) and select Additional Mount Options
uncheck Automatic Mount Options if on to enable options
uncheck Show in user interface
enter /home/user/xxxx into Mount Point line (mount partition into /home/user/xxxx folder)
optional-open /ect/fstab to verify that line was added at bottom of file
Change ownership of folder from root to user
$ sudo chown -R user:user /home/user/xxxx (change ownership of /home/user/xxxx from root to user)
Reboot and partition should automount in folder /home/user/xxxx with user as owner of folder

I mount my data drives at /home/user folder just to make them easy to find, but the mounted drives will also show up as Devices. You can access the drives from either location.

When you add drives with Disks, the drives owner will be root. When you run chown, command will change owner from root to what ever user name that you put into the command. You can then change the access rights for other local users by right click-properties-permissions and changing access rights to Group and Others. As owner, you can also set shares to allow network access. I personally use samba to allow cif/smb access on my home network.

Edit to add link to original post on how I setup my PC viewtopic.php?f=50&t=293119
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

Re: Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

I read your original thread athi, thank you. It helped in my attempting to figure this all out.

So, in my case then (to be sure I understand), I can make the owner of the mounted partition as my admin or any other account.

Then just change the permissions to basically allow everyone (the "other" group?) full access.

Off the top of your head, do you know if I have to mount the partitions again for the other users? Obviously I'll experiment and report back before marking this solved, but figured I'd ask.
athi

Re: Mounting Shared Partition Woes (newbie)

Post by athi »

You are welcome. I would make the primary admin user as owner of the drives. If you give Others full access, then all users, including Guest, will have full access to the drives.

I do not have multiple users on my PC to test but once the drive is mounted by any user, all users on the PC should see the drives. Please let me know if this is the case.
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

Re: Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

Overall works. Everyone (me, myself, and_I) can indeed see the drive (set as mnt/Data).
Everyone can write to the drive.

What I'm tripping on now (can't decide if it's good or bad) is that when writing, each user account is creating files & directories with their default permissions.
So if "myself" creates a directory then "me" can see what's there. But "me" can't create new files. If I open a text file it's in read only mode.

I added all 3 accounts to the "users" group.
Then set the admin account (and_I) as the user account that owns the mount point and the "users" group as the group ownership. Both have full access.
And this does effectively create my own "homebrew" home partition.

Is there a (relatively easy and secure) way to force the mount point's group ownership on newly created files without having to manually do it?
I'm sure there is somewhere, but at this stage of my tux-skills it may not be worth exploring if it's too involved.

I will have to ponder altering my workflow to account for the new OS... <sigh>. Not necessarily a bad thing and (eventually) I'll figure this puppy out. And until then I've got to get my data transferred and this build finished.

So thank you again for your help. Your instructions moved me much further along than I would have been.
athi

Re: Mounting Shared Partition Woes (newbie)

Post by athi »

Thank you for the update. I too am a Windows user from 3.1, NT to 7, started using Ubuntu along with Win7 after Win8 came out and seeing the direction MS was going with the Metro desktop. Converted to Mint Mate after Ubuntu changed the desktop to Gnome3, just too used to Gnome2 interface and did not care for the feel of Gnome3. Now only use Win7 in VM to do taxes, most likely converting to Win10 VM for next year taxes.

File level security does take a little getting used to after Windows and I manually changed file permissions as root when it gets too annoying. I am sure that you can write a script to automate changing file permissions for the home folder and run with cron or manually via terminal. Not my area of expertise, you should post on the software support forum and somebody can help you.
altair4
Level 20
Level 20
Posts: 11426
Joined: Tue Feb 03, 2009 10:27 am

Re: Mounting Shared Partition Woes (newbie)

Post by altair4 »

Please verify that I have interpreted your posts correctly. It looks like you mounted this partition to /mnt/Data, with permissions of 777 and with group ownership set to users.

[1] Change permissions to 775:

Code: Select all

sudo chmod 775 /mnt/Data
[2] Apply the setgid bit:

Code: Select all

sudo chmod g+s /mnt/Data
All new files added to /mnt/Data from anyone in the users group will have group set to users with write access to that group.

Note:

This will work as long as you do all transactions through Nemo. It will not work if you create files through the terminal ( as in touch /mnt/Data/touchtest.txt ). For that to work in a terminal you have to use Ubuntu Server, Xubuntu, Linux Mint XFCE, or use something called bindfs.

As an example in my test machine:
tester@vmin191cinn:~$ ls -al /DataL
total 24
drwxrwsr-x 3 root plugdev 4096 May 12 08:22 .
drwxr-xr-x 27 root root 4096 May 12 07:58 ..
drwx------ 2 root root 16384 Dec 11 13:10 lost+found
-rw-rw-r-- 1 tester plugdev 0 May 12 08:21 test.txt
-rw-r--r-- 1 tester plugdev 0 May 12 08:22 touchtest.txt
test.txt was created by Nemo and it saved the file with plugdev group ( in my case I used plugdev not users ) and permissions of 664. touchtest.txt was created in the terminal where the setgid bit still forced the group to be plugdev but permissions are set to 644 - readable but not writeable to the plugdev group.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

Re: Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

athi wrote: Sat May 11, 2019 9:56 pm you should post on the software support forum and somebody can help you.
Will do. Once I get up and running playing with VMs is next. No reason to throw away perfectly useful windows software I've used for years...

Thanks again
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

Re: Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

altair4 wrote: Sun May 12, 2019 8:29 am Please verify that I have interpreted your posts correctly.
I'm not sure I've interpreted my posts correctly...
altair4 wrote: Sun May 12, 2019 8:29 am It looks like you mounted this partition to /mnt/Data, with permissions of 777 and with group ownership set to users.
Mount to Data (/mnt/Data/)

Well, I used gui (right click on Data in mnt ).

Owner: Admin
Folder Access: Create and Delete Files
File Access: ------

Group: users
Folder Access: Create and Delete Files
File Access: ------
Folder Access: Create and Delete Files
File Access: ------

When I use the terminal:

Code: Select all

ls - /mnt/
drwxrwxrwx Admin users

[code]ls - /mnt/Data/
drwxrwxrwx root root lost+found
drwxrwxrwx root root Dir1
drwxrwxrwx root root Dir2
So obviously something is awry here...Your advice:
altair4 wrote: Sun May 12, 2019 8:29 am [1] Change permissions to 775:

Code: Select all

sudo chmod 775 /mnt/Data
[2] Apply the setgid bit:

Code: Select all

sudo chmod g+s /mnt/Data
So this will (assuming I understand you correctly):

[1) Set the permissions on Data to be:
Owner: rwx
Group: rwx
Other: rw

2) Force everything inside Data to be created with the group set to the same group as the directory (in this case "users"). Provided I create it through nemo or some other program (libreoffice, browser download, etc). If I create a file from within the terminal (using touch) it will not.

Assuming I understood you correctly, that will work just fine for me (especially at this point in my linux life). I'll test it within the hour and report back.

Thank you
SomeDudeInAZ
Level 4
Level 4
Posts: 251
Joined: Sun May 05, 2019 6:48 pm
Location: Scottsdale, AZ, USA

Re: [SOLVED] Mounting Shared Partition Woes (newbie)

Post by SomeDudeInAZ »

altair4: Looks like that did the trick :D

Thanks again to both of you for helping me out.
Locked

Return to “Storage”