Peppermint OS

Support => Advanced Topics => Topic started by: AndyInMokum on February 19, 2017, 01:37:08 am

Title: Shared /DATA partition permissions.
Post by: AndyInMokum on February 19, 2017, 01:37:08 am
My System Information
[/color][/b]
Code: [Select]
andy@andy-Latitude-E6410 ~ $ inxi -Fz
System:    Host: andy-Latitude-E6410 Kernel: 4.8.0-36-generic x86_64 (64 bit)
           Desktop: N/A Distro: Peppermint Seven
Machine:   System: Dell (portable) product: Latitude E6410 v: 0001
           Mobo: Dell model: 0667CC v: A03 Bios: Dell v: A16 date: 12/05/2013
CPU:       Dual core Intel Core i5 M 560 (-HT-MCP-) cache: 3072 KB
           clock speeds: max: 2667 MHz 1: 1466 MHz 2: 1333 MHz 3: 1599 MHz
           4: 1333 MHz
Graphics:  Card: Intel Core Processor Integrated Graphics Controller
           Display Server: X.Org 1.18.4 drivers: (unloaded: fbdev,vesa)
           Resolution: 1280x800@60.00hz
           GLX Renderer: Mesa DRI Intel Ironlake Mobile
           GLX Version: 2.1 Mesa 12.0.6
Audio:     Card Intel 5 Series/3400 Series High Definition Audio
           driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.8.0-36-generic
Network:   Card-1: Intel 82577LM Gigabit Network Connection driver: e1000e
           IF: eno1 state: down mac: <filter>
           Card-2: Intel Centrino Advanced-N 6200 driver: iwlwifi
           IF: wlp2s0 state: up mac: <filter>
Drives:    HDD Total Size: 1120.2GB (21.5% used)
           ID-1: /dev/sda model: KINGSTON_SV300S3 size: 120.0GB
           ID-2: /dev/sdb model: WDC_WD10JPVX size: 1000.2GB
Partition: ID-1: / size: 20G used: 5.1G (28%) fs: ext4 dev: /dev/sda5
           ID-2: /home size: 17G used: 4.0G (26%) fs: ext4 dev: /dev/sda6
           ID-3: swap-1 size: 8.59GB used: 0.00GB (0%) fs: swap dev: /dev/sdb2
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 55.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 221 Uptime: 7 min Memory: 973.8/7908.9MB
           Client: Shell (bash) inxi: 2.2.35
andy@andy-Latitude-E6410 ~ $
Hi everyone, how's it going?  I've run into an issue I can't get my head around  :-\.  I'm dual booting Peppermint 7 64-bit alongside the Arch based: OBRevenge OS 64-bit.  I've set up my system with a separate /DATA partition.  I share this with any distro I'm multibooting with Peppermint 7.  I've never had an issue with setting this up.  I've done it so many times, I've lost count.  I always keep the same user name across the distros: "andy".  I always use /mnt/DATA as the mount point for the separate /DATA partition.  I always set up ownership of the partition with:
Code: [Select]
sudo chown -R andy:andy /mnt/DATAThis has always worked flawlessly, until now.  When I boot into either Peppermint 7 or OBRevenge OS.  The first thing I have to do, is re-establish the ownership for: /mnt/DATA.  To say it has me baffled, is an understatement  :-\.  Any ideas are much appreciated - thanks  ;).
Title: Re: Shared /DATA partition permissions.
Post by: murraymint on February 19, 2017, 05:11:02 am
I think the users are assigned numbers, so could you somehow have a different number on each distro?
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 19, 2017, 05:53:20 am
I think the users are assigned numbers, so could you somehow have a different number on each distro?
Great idea. It is quite possible.
Andy, in both OS's run the command
Code: [Select]
idSee if "uid" is the same (1000) in both.
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 19, 2017, 09:29:54 am
What they said .. check the user ID's are the same.
(not all distros assign uid 1000 to the first user account .. usernames mean sod all if the uid isn't the same)

Or make the mountpoint read/write by everyone.
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 19, 2017, 03:13:49 pm
What they said .. check the user ID's are the same.
(not all distros assign uid 1000 to the first user account .. usernames mean sod all if the uid isn't the same)

Or make the mountpoint read/write by everyone.
Yeah it's different in OBRevenge OS
Code: [Select]
[andy@andy-obr ~]$ id
uid=1001(andy) gid=1001(andy) groups=1001(andy),4(adm),7(lp),10(wheel),90(network),91(video),92(audio),94(floppy),95(storage),96(scanner),100(users)
and this is Peppermint 7
Code: [Select]
andy@andy-Latitude-E6410 ~ $ id
uid=1000(andy) gid=1000(andy) groups=1000(andy),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),123(sambashare),124(lpadmin)
andy@andy-Latitude-E6410 ~ $
What would be your suggestion to match them up?

Many thanks: murraymint and ColonelPanic for your assistance.  It makes sense now.  I knew it had to be something simple.  I've just never come across it before  ;).
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 19, 2017, 04:13:20 pm
How are you mounting /mnt/DATA Andy ?
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 19, 2017, 06:12:34 pm
How are you mounting /mnt/DATA Andy ?

My /DATA partition is on /dev/sdb1.  I'm using:
Code: [Select]
sudo mount /dev/sdb1 /mnt/DATAI'm then changing the ownership with:
Code: [Select]
sudo chown -R andy:andy /mnt/DATAThat's it.  I hope that's what you mean  :-\.

Edit:  Sorry, I forgot the /etc/fstab contents:
Code: [Select]
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=7a4f8b35-8877-4529-b79a-eab4cd010a85 /               ext4    noatime,errors=remount-ro 0       1
# /home was on /dev/sda6 during installation
UUID=abfcfbd1-881b-46b9-a4b9-1e2e808a1329 /home           ext4    noatime,defaults        0       2
# swap was on /dev/sdb2 during installation
UUID=45ec0c95-914b-47c6-936f-300ce947ee18 none            swap    sw              0       0
# User created /DATA partition.  Mount point /mnt/DATA.
UUID=8a9f41c5-fd91-4895-83df-67207ebe3970 /mnt/DATA ext4 defaults 0 2
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 19, 2017, 08:07:45 pm
Yeah it's different
What would be your suggestion to match them up?

I assume that on OBRevenge OS you have a different user, not named andy, who has the uid of 1000
Is that correct?
If you do not, you can change that 1001 to 1000.
If you do, then you can change the 1000 on Peppermint 7 to 1001, so that they match.

Here are the commands to run as root to change the UID and GID for a user. Simply change the variables in angled brackets to match your settings:

usermod -u <NEWUID> <LOGIN>   
groupmod -g <NEWGID> <GROUP>
usermod -g <NEWGID> <LOGIN>
usermod and groupmod simply change the UID and GID for their respective named counterpart.
usermod also changes the UID for the files in the homedir but naturally we can’t assume the only place files have been created is in the homedir.
The final usermod command changes the login group for the user.

To change the UID on files:
find / -username <OLDUID> -exec chown -h <NEWUID> {} \;
To change the GID:
find / -username <OLDGID> -exec chgrp -h <NEWGID> {} \;
The find command recurses the filesystem from / and changes everything with UID of OLDUID to be owned by NEWUID and them changes the group for the files owned by the OLDGROUP.
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 09:49:45 am
If this is only a storage partition (docs/pics/music/etc.) wouldn't it be simpler to just recursively make it read/write/execute by anyone ?
Code: [Select]
sudo chmod -R 777 /mnt/DATA
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 20, 2017, 02:19:10 pm
Thanks everyone for the suggestions.  ;).   ColonelPanic, I tried applying:

Quote
usermod -u <NEWUID> <LOGIN>   
groupmod -g <NEWGID> <GROUP>I
usermod -g <NEWGID> <LOGIN>
usermod and groupmod simply change the UID and GID for their respective named counterpart.
usermod also changes the UID for the files in the homedir but naturally we can’t assume the only place files have been created is in the homedir.
The final usermod command changes the login group for the user.

in OBRevenge OS, just because I want to keep the UID 1000.  It was having none of it  :-\.  I haven't tried using the instructions on Peppermint 7.

PCNetspec, your blanket permission for everyone seemed like a good idea.  I keep my Dropbox folder on the /DATA partition.  It's simlinked my ~/ folder.   Not a  problem when changing ownership and group to: andy:andy.  Applying 777 and Dropbox freaks out.  It refuses to open and asks for my user password to access it.  It does exactly the same in OBRevenge OS  The only way to access my Dropbox folder is to change the permissions on it back to:
Code: [Select]
sudo chown -R andy:andy /mnt/DATA/Dropbox
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 20, 2017, 02:39:51 pm
ColonelPanic, I tried applying:
usermod -u <NEWUID> <LOGIN>   
groupmod -g <NEWGID> <GROUP>I
usermod -g <NEWGID> <LOGIN>
in OBRevenge OS, just because I want to keep the UID 1000.  It was having none of it.
What command did you use exactly?
Did you note the part about "Here are the commands to run as root"? That means use "sudo" before each command.
Is there another user in OBRevenge OS that might already have the uid of 1000?
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 03:13:00 pm
Safest way to do this....

Create a new user on either Peppermint or Arch with the same UID as the other ... then set it up how you like it.
(the next user account you create in Peppermint will likely be 1001 anyway).

There are other ways to map one uid to another but that'd probably be the easiest/safest.

Another method would be to add the user in both distros to a "group" in both distros with the same gid (group ID) .. then set the ownership of /mnt/DATA to that group .. if you get what I mean.

There are multiple ways of achieving this .. all have pluses and minuses except having the same uid.
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 20, 2017, 03:18:51 pm
ColonelPanic, I tried applying:
usermod -u <NEWUID> <LOGIN>   
groupmod -g <NEWGID> <GROUP>I
usermod -g <NEWGID> <LOGIN>
in OBRevenge OS, just because I want to keep the UID 1000.  It was having none of it.
What command did you use exactly?
Did you note the part about "Here are the commands to run as root"? That means use "sudo" before each command.
Is there another user in OBRevenge OS that might already have the uid of 1000?
This is the command I used in OBRevenge OS along with my id and the output:
Code: [Select]
[andy@andy-obr ~]$ id
uid=1001(andy) gid=1001(andy) groups=1001(andy),4(adm),7(lp),10(wheel),90(network),91(video),92(audio),94(floppy),95(storage),96(scanner),100(users)
[andy@andy-obr ~]$ sudo usermod -u 1000 andy
[sudo] password for andy:
usermod: user andy is currently used by process 643
[andy@andy-obr ~]$
I'm the only user.  There are no other accounts  :-\.
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 03:25:12 pm
You're probably lucky that didn't go through, as it would have meant you no longer owned your own /home/andy folder and config files.
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 20, 2017, 03:45:19 pm
You're probably lucky that didn't go through, as it would have meant you no longer owned your own /home/andy folder and config files.
No.

Code: [Select]
man usermod
Quote
   -u, --uid UID
           The new numerical value of the user's ID.


           This value must be unique, unless the -o option is used. The value must be non-negative.


           The user's mailbox, and any files which the user owns and which are located in the user's home directory will have the file user
           ID changed automatically.


           The ownership of files outside of the user's home directory must be fixed manually.

Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 04:19:28 pm
I stand corrected :)
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 20, 2017, 04:20:26 pm
You're probably lucky that didn't go through, as it would have meant you no longer owned your own /home/andy folder and config files.
No.

Code: [Select]
man usermod
Quote
   -u, --uid UID
           The new numerical value of the user's ID.


           This value must be unique, unless the -o option is used. The value must be non-negative.


           The user's mailbox, and any files which the user owns and which are located in the user's home directory will have the file user
           ID changed automatically.


           The ownership of files outside of the user's home directory must be fixed manually.

This changing IDs is totally new territory for me.  It's both frustrating and interesting.  I'm going to have to think about how to attack this, with the help of good ol' YouTube tutorials  ;).  This is why I'm making any modifications over on the the OBRevenge OS side.  it's only there as a test OS.  I don't care if it all goes pear shaped there  ;D.
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 04:24:43 pm
Does obrevenge have an active "root" account ?

What I mean is .. can you log off as "andy", then Ctrl+Alt+F3 and log onto the console as "root" ?
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 20, 2017, 04:44:04 pm
Does obrevenge have an active "root" account ?

What I mean is .. can you log off as "andy", then Ctrl+Alt+F3 and log onto the console as "root" ?

When I created the user account during installation, I was given the option to use my user account password as my "root" password.  I chose this.
Title: Re: Shared /DATA partition permissions.
Post by: PCNetSpec on February 20, 2017, 05:09:35 pm
Well the only two ways I can see to do this then is either

a) create another account in OBR, give it sudo privileges .. log onto it, then use that account to change the uid of the andy account.

or

b) Figure out how you boot into single user mode (a root terminal) in OBR/Arch .. then change the uid of andy.
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 20, 2017, 05:45:45 pm
Well the only two ways I can see to do this then is either

a) create another account in OBR, give it sudo privileges .. log onto it, then use that account to change the uid of the andy account.

or

b) Figure out how you boot into single user mode (a root terminal) in OBR/Arch .. then change the uid of andy.

I'll have a tinker around with this later this morning.  It'll be a good exercise.  You never know, I might learn something  :)).
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 20, 2017, 08:25:38 pm


I'm back. I had to take a break to get my Minimum Daily Requirement of Vitamin T... (Tequila)
What version of OBRevenge OS do you have? (regarding log in to root shell)
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 21, 2017, 01:46:55 am


I'm back. I had to take a break to get my Minimum Daily Requirement of Vitamin T... (Tequila)
What version of OBRevenge OS do you have? (regarding log in to root shell)

Hahah, I understand :))!!  The OBRevenge OS version is:
Code: [Select]
Arch Linux 4.9.9-1-ARCH (tty2)
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 21, 2017, 04:15:47 am

 Well, I guess "What version of OBRevenge OS do you have?" turns out to be a dumb question when only one version exists...  ???
 
 You can try to get to a tty3 console with Ctrl+Alt+F3, as PCNetSpec suggested. Or you can press e (for Edit) in the Grub menu, and append "rw systemd.unit=multi-user.target" to the line that starts with "linux" in place of "quiet splash" (if that is there). Then press F10 to boot. That will take you to a root shell where you can enter the usermod commands (no "sudo" needed).
 
 There is an alternative to those 2 options. Boot into Peppermint and enter these commands in a terminal.
NOTE! Here I am assuming that your OBRevenge OS root partition is /dev/sda2 - just a wild guess. Change that to the actual OBRevenge OS root partition designation.

 Mount the OBRevenge OS root partition at /mnt:
 
Code: [Select]
sudo mount /dev/sda2 /mnt
Code: [Select]
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
Code: [Select]
sudo chroot /mnt The prompt will change to a root prompt.
 Enter the usermod commands (no "sudo" required).
 
Code: [Select]
usermod -u 1000 andy
Code: [Select]
groupmod -g 1000 andy
Code: [Select]
usermod -g 1000 andy
 CTRL-D to exit chroot
 CTRL-D to exit the terminal
Title: Re: Shared /DATA partition permissions.
Post by: ColonelPanic on February 21, 2017, 04:27:58 am
Is your OBRevenge OS set up with a separate /home partition?


Good luck. I will be scarce around these parts for the next few weeks. I have a mountain of real-world work facing me...
Title: Re: Shared /DATA partition permissions.
Post by: AndyInMokum on February 21, 2017, 02:36:08 pm
Is your OBRevenge OS set up with a separate /home partition?


Good luck. I will be scarce around these parts for the next few weeks. I have a mountain of real-world work facing me...

Sorry, I didn't get back sooner.  It's been a stupid busy day here too.  My laptop had two drives, an SSD for my distros and a HDD for my /DATA and swap space.  Yeah, OBRevenge OS has separate /home partition.  I alway run a fdisk -l check before messing with partitions.   In my early days of using dd, it bit me on the arse/ass big time; never again though  ;).   OBRevenge OS is on /dev/sda7, (/root) and  /dev/sda8, (/home):
Code: [Select]
Disk /dev/sda: 111,8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x92fd009f

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            4094 234441647 234437554 111,8G  5 Extended
/dev/sda5            4096  41947455  41943360    20G 83 Linux
/dev/sda6        41949184  77600767  35651584    17G 83 Linux
/dev/sda7  *     77602816 119545855  41943040    20G 83 Linux
/dev/sda8       119547904 155189247  35641344    17G 83 Linux


Disk /dev/sdb: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000795af

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdb1             2048 1936748543 1936746496 923,5G 83 Linux
/dev/sdb2       1936748544 1953523711   16775168     8G 82 Linux swap / Solaris
andy@andy-Latitude-E6410 ~ $