Can 2 different linuxdistros own of the same data partition?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Can 2 different linuxdistros own of the same data partition?

Post by Doruletz »

Hi.

What I want to do is install 2 different Linux distros on the same computer (Linux Mint 10 Julia 64 bit and Ubuntu Ultimate Edition Gamers 2.8 64 bit).

Can they both take turns into claiming ownership of the same data storage partition mounted in the /media directory?
Basically I don't want to have to manually change permissions for each and every file/folder created by one of the Linux distros while i need to access/modify it in the other Linux distro.

Can this be done and how?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
What do I think about Window$??? Just take a look at my AVATAR...
wayne128

Re: Can 2 different linuxdistros own of the same data partit

Post by wayne128 »

I make thing simple for me to share data partition with windows as well as all Linux OSes in the same computer.
What I did was I have NTFS partition, bot windows OS and Linux OSes can read and write onto them.
Similar thing on USB stick or USB drive, when I format them to FAT32 or NTFS, windows and Linux OS can share without issue.
DataMan

Re: Can 2 different linuxdistros own of the same data partit

Post by DataMan »

Can they both take turns into claiming ownership of the same data storage partition mounted in the /media directory?
Yes

I have 17 mounted data partitions (I mount in /mnt vs /media - keeps the desktop neater) across 3 different operating (Linux) systems.

Select the manual partition option when installing and identify the partitions and mount points for your data partitions. This will build the /etc/fstab correctly at installation.

-DataMan
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Can 2 different linuxdistros own of the same data partit

Post by altair4 »

If the two linux distros are Ubuntu based ( and maybe even Debian based ) and you have the same user name and user uid number on both then you should be able to pull this off.

If the two distros are from different branches of the linux family tree then it gets more complicated because user=altair in Ubuntu has a uid=1000 and user=altair in a redhat derived distro has a uid=500 ( I think it's 500 - it's been a while ). So technically altair does not = altair.

Ironically, as wayne128 mentioned, using an NTFS partition actually makes this easier since all files and folders in a mounted NTFS partition will inherit the ownership and permissions of the mount point defined in fstab. Linux filesystems don't do that.

Is the data partition formatted in ext3 or ext4 or in NTFS?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
rivenathos
Level 6
Level 6
Posts: 1070
Joined: Wed May 06, 2009 7:32 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by rivenathos »

I already run all my systems with what you asked about, but with one difference. I use /data instead of /media, and then share the /data with any other distro installed.
Current hardware: a Dell OptiPlex 3010 desktop, a Dell Inspiron 531 desktop, and a Dell Inspiron 1545 laptop.
Current OS: LMDE 3
StanTheMan

Re: Can 2 different linuxdistros own of the same data partit

Post by StanTheMan »

I have an extra dta partition where I store a lot of my document files.
I have nine Linux distros installed, and each of them can read and write to this data partition.
It is /dev/sda16,
Each distro has a folder that I created called /media/sda16,
In each distro , this folder has permissions - - Owner=root , Grouup=plugdev .
Each User is made a member of the group " plugdev "
The permissions of the folder /media/sda16 are set Group=read and write.

Now in each distro, any User who is a member of the group " plugdev " can read and write to that partition sda16 .
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Can 2 different linuxdistros own of the same data partit

Post by altair4 »

This may all be academic since I'm guessing that Mint 10 and Ubuntu Ultimate Edition Gamers 2.8 are close enough that user=altair on one is the same as user=altair on the other and you shouldn't have to change ownership or permissions.

But on a broader level of two randomly selected Linux distros then it gets complicated depending on your requirements and how many users you have on each system. As I read your original post you want:
Basically I don't want to have to manually change permissions for each and every file/folder created by one of the Linux distros while i need to access/modify it in the other Linux distro.
You want the ability to write to a file created by a user on one Linux from the other.

Let's take StanTheMan's example. If I read it correctly he did the following:

Code: Select all

sudo chown :plugdev /media/sda16
sudo chmod 0775 /media/sda16
Assuming that each Linux has a plugdev group and it's gid is 46 then as he described you will in fact be able to add or delete a file to the common partition. You will not however be able to write to a specific file. When user "bob" creates a file on Linux1 it will save with owner:group = bob:bob and permissions of 644. Any user on Linux2 will be able to read the file but not write to it ( which BTW is what you may want it to do to prevent chaos )

You could modify the chmod command to this:

Code: Select all

sudo chmod 2775 /media/sda16
That will force any new file created in either Linux to have group=plugdev ( assumming you did a chown :plugdev first ). But that doesn't completely fix the problem either since when "bob" adds a new file it will now save as owner:group = bob:plugdev but permissions are still at 0644. Plugdev on the other Linux can still only read the file and not write to it. So now you have to go one step further and change the default umask from 022 to 002. Now when bob creates a new file on Linux1 it will save with permissions of 664 ( group can now write ) and the "chmod 2775" on the parent directory will force the file to have group = plugdev.

Anyway, I think that's the way it all works. :)

Edited to correct octal permissions on a file. Should have been 6xx not 7xx.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
MALsPa
Level 8
Level 8
Posts: 2040
Joined: Mon Nov 19, 2007 10:17 pm
Location: albuquerque

Re: Can 2 different linuxdistros own of the same data partit

Post by MALsPa »

Doruletz wrote:Basically I don't want to have to manually change permissions for each and every file/folder created by one of the Linux distros while i need to access/modify it in the other Linux distro.
As others have noted, this shouldn't be a problem between Mint and Ubuntu, the usernames in both distros will be the same, right? But I used the following command in PCLOS and Fedora when adding them to a set-up that previously had only Debian-based distros:

#usermod -u 1000 -g 100 steve
StanTheMan

Re: Can 2 different linuxdistros own of the same data partit

Post by StanTheMan »

In my case , the extra data partition ( sda16 ) was in addition to a " /home " partition which was used only by my working distro.
The /home/User directory on the working distro is owned by that User.
The other distros have their /home directory " with nothing mounted on it " (they are part of the root system.
My e-mails and bookmarks only appear in the smaller partition which is is mounted on the working distro when that distro is loaded.
The other larger partition ( sda16 ) is owned by Root.
It just means that you must remember that your e-mails and bookmarks are in one directory, and all the document files will be accessed in the other directory.
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

wayne128 wrote:I make thing simple for me to share data partition with windows as well as all Linux OSes in the same computer.
What I did was I have NTFS partition, bot windows OS and Linux OSes can read and write onto them.
Similar thing on USB stick or USB drive, when I format them to FAT32 or NTFS, windows and Linux OS can share without issue.
Wayne, that's just the big problem. Viruses can thrive on an NTFS partition, for the simple fact that Windows can access it and write all kinds of bad stuff to it. If you want to be worry free use ext4 partitions for data storage.
What do I think about Window$??? Just take a look at my AVATAR...
willie42
Level 7
Level 7
Posts: 1970
Joined: Tue Jun 22, 2010 7:52 pm
Location: Oak Ridge, TN USA

Re: Can 2 different linuxdistros own of the same data partit

Post by willie42 »

Viruses are only Dangerous in Windows environment because of the .EXE factor. So the filing system is not the determining factor when it comes to viruses its the Operating system its self that is the Excuter of viruses.
Comptia A+ Certified Technician
Comptia Network + Certified Technician
You can not have Success without Failures.
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

altair4 wrote:If the two linux distros are Ubuntu based ( and maybe even Debian based ) and you have the same user name and user uid number on both then you should be able to pull this off.

If the two distros are from different branches of the linux family tree then it gets more complicated because user=altair in Ubuntu has a uid=1000 and user=altair in a redhat derived distro has a uid=500 ( I think it's 500 - it's been a while ). So technically altair does not = altair.

Ironically, as wayne128 mentioned, using an NTFS partition actually makes this easier since all files and folders in a mounted NTFS partition will inherit the ownership and permissions of the mount point defined in fstab. Linux filesystems don't do that.

Is the data partition formatted in ext3 or ext4 or in NTFS?
altair, the data partition is ext4, and I'm just guessing that when I install the second distro I just tell it to mount the data partition, then use

Code: Select all

sudo chown ....
to take ownership of the data partition in both distros. This way whichever distro I boot into will own said data partition and I can access, read/write, create/delete, copy/paste or otherwise modify files and folders on the data partition in both distros, one distro having unlimited access to all files and folders created by the other distro and vice-versa. Right?
What do I think about Window$??? Just take a look at my AVATAR...
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

willie42 wrote:Viruses are only Dangerous in Windows environment because of the .EXE factor. So the filing system is not the determining factor when it comes to viruses its the Operating system its self that is the Excuter of viruses.
Believe it or not willie24 there are viruses that affect Linux. It is very hard or near impossible to get infected in Linux, but if you access a file created by Windows that contains a Linux virus you are bound to get it.
There is a Windows software out there that allows Windows to access Linux partitions (ext2, ext3, ext4). Why do you think they created that? To be able to pass viruses onto Linux systems...
The safest way is to keep the 2 separated. Leave NTFS partitions for Windows only and do all your Linux stuff in ext4 partitions.
What do I think about Window$??? Just take a look at my AVATAR...
willie42
Level 7
Level 7
Posts: 1970
Joined: Tue Jun 22, 2010 7:52 pm
Location: Oak Ridge, TN USA

Re: Can 2 different linuxdistros own of the same data partit

Post by willie42 »

Doruletz wrote:
willie42 wrote:Viruses are only Dangerous in Windows environment because of the .EXE factor. So the filing system is not the determining factor when it comes to viruses its the Operating system its self that is the Excuter of viruses.
Believe it or not willie24 there are viruses that affect Linux. It is very hard or near impossible to get infected in Linux, but if you access a file created by Windows that contains a Linux virus you are bound to get it.
There is a Windows software out there that allows Windows to access Linux partitions (ext2, ext3, ext4). Why do you think they created that? To be able to pass viruses onto Linux systems...

Linux viruses are code that yes can infect a Linux system. It does not matter what filing system you are running. If you have code for Linux it will corrupt a system. As of yet I have not seen or heard of these 2 things. if you can provide me links to them I would appreciate it.

1. Running Linux on an NTFS filing system.

2. Where a Linus user has click on an .EXE file and obtained a Virus.
Comptia A+ Certified Technician
Comptia Network + Certified Technician
You can not have Success without Failures.
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

willie42 wrote:
Doruletz wrote:
willie42 wrote:Viruses are only Dangerous in Windows environment because of the .EXE factor. So the filing system is not the determining factor when it comes to viruses its the Operating system its self that is the Excuter of viruses.
Believe it or not willie24 there are viruses that affect Linux. It is very hard or near impossible to get infected in Linux, but if you access a file created by Windows that contains a Linux virus you are bound to get it.
There is a Windows software out there that allows Windows to access Linux partitions (ext2, ext3, ext4). Why do you think they created that? To be able to pass viruses onto Linux systems...

Linux viruses are code that yes can infect a Linux system. It does not matter what filing system you are running. If you have code for Linux it will corrupt a system. As of yet I have not seen or heard of these 2 things. if you can provide me links to them I would appreciate it.

1. Running Linux on an NTFS filing system.

2. Where a Linus user has click on an .EXE file and obtained a Virus.
1. I did not say anything about running Linux on NTFS, I was reffering to accesing an infected NTFS partition in Linux.
2. Not all viruses are in an .exe format. They can also be dll, script, code, etc....
What do I think about Window$??? Just take a look at my AVATAR...
willie42
Level 7
Level 7
Posts: 1970
Joined: Tue Jun 22, 2010 7:52 pm
Location: Oak Ridge, TN USA

Re: Can 2 different linuxdistros own of the same data partit

Post by willie42 »

exactly....the only way that Linux can be infected is by running bad code in the Terminal, installing it with GDebi, or compiling it and then intro into your system. With windows all it takes for intro is a click on an EXE file. So you can have a Virus on your NTFS Partition but unless you do any of the above 3 things the virus will not endanger your Linux system. That is what makes Linux secure. We have Clamav to scan mail for viruses to protect those poor windows users.

thanks :D

edit: you can have infected dlls scripts and such but they have to be introduced into your system to do anything. Via the 3 methods mentioned
Comptia A+ Certified Technician
Comptia Network + Certified Technician
You can not have Success without Failures.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Can 2 different linuxdistros own of the same data partit

Post by altair4 »

altair, the data partition is ext4, and I'm just guessing that when I install the second distro I just tell it to mount the data partition, then use

Code: Select all
sudo chown ....

to take ownership of the data partition in both distros. This way whichever distro I boot into will own said data partition and I can access, read/write, create/delete, copy/paste or otherwise modify files and folders on the data partition in both distros, one distro having unlimited access to all files and folders created by the other distro and vice-versa. Right?
If you do a "sudo chown username ... " on the data partition in your current Mint OS AND then you install another Ubuntu-based OS AND you create the same username on that new OS then I'm betting that the the usename's on both systems will have the same uid and both systems will see them as their own. You shouldn't have to do a chown on the other OS since the ownership and permissions are embedded within the files itself.

The only problem is when you start to use distro's from another family like PCLinuxOS or Suse. Then you can use MALsPa's technique or mine to accommodate users from both systems.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

altair4 wrote:
altair, the data partition is ext4, and I'm just guessing that when I install the second distro I just tell it to mount the data partition, then use

Code: Select all
sudo chown ....

to take ownership of the data partition in both distros. This way whichever distro I boot into will own said data partition and I can access, read/write, create/delete, copy/paste or otherwise modify files and folders on the data partition in both distros, one distro having unlimited access to all files and folders created by the other distro and vice-versa. Right?
If you do a "sudo chown username ... " on the data partition in your current Mint OS AND then you install another Ubuntu-based OS AND you create the same username on that new OS then I'm betting that the the usename's on both systems will have the same uid and both systems will see them as their own. You shouldn't have to do a chown on the other OS since the ownership and permissions are embedded within the files itself.

The only problem is when you start to use distro's from another family like PCLinuxOS or Suse. Then you can use MALsPa's technique or mine to accommodate users from both systems.
altair, I don't want the same username in both distros. I want to have separate user folders in the shared /home partition, that way each distro keeps its own settings and there is no confusion.
For example I will be user dorumint in Mint 10 and user dorubuntu in Ultimate 2.8....
This will give me 2 separate user folders inside the same /home partition.
What do I think about Window$??? Just take a look at my AVATAR...
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Can 2 different linuxdistros own of the same data partit

Post by altair4 »

Well then you're back to my original post.

On the current Mint:

Code: Select all

sudo chown :plugdev /media/Data
sudo chmod 2775 /media/Data
Change the default umask by editing the following file as root:

Code: Select all

/etc/profile
And change the last entry to:

Code: Select all

umask 002
That will take care of every new directory / file created in Mint as it will save the file as owner:group = dorumint:plugdev with permissions = 775 / 664.

On the Ubuntu OS:
The only thing you need to do is change the default umask to 002

When you save a directory / file in that OS it will save as owner:group = dorubuntu:plugdev with permissions of 775 / 664

EDIT: Don't mean to get into the middle of a disagreement about NTFS and viruses and such but you could mount the NTFS the way it used to be done in the good old days:

Code: Select all

/dev/sda3 /media/DataNTFS ntfs defaults,dmask=0000,fmask=0111,utf8 0 0
The "fmask = 0111" will remove the "execute bit" from every file on the partition and the resulting directory permissions would be 0777 and files would be 0666.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
Doruletz
Level 4
Level 4
Posts: 329
Joined: Sun Aug 15, 2010 1:00 am
Location: USA

Re: Can 2 different linuxdistros own of the same data partit

Post by Doruletz »

altair4 wrote:Well then you're back to my original post.

On the current Mint:

Code: Select all

sudo chown :plugdev /media/Data
sudo chmod 2775 /media/Data
Change the default umask by editing the following file as root:

Code: Select all

/etc/profile
And change the last entry to:

Code: Select all

umask 002
That will take care of every new directory / file created in Mint as it will save the file as owner:group = dorumint:plugdev with permissions = 775 / 664.

On the Ubuntu OS:
The only thing you need to do is change the default umask to 002

When you save a directory / file in that OS it will save as owner:group = dorubuntu:plugdev with permissions of 775 / 664

EDIT: Don't mean to get into the middle of a disagreement about NTFS and viruses and such but you could mount the NTFS the way it used to be done in the good old days:

Code: Select all

/dev/sda3 /media/DataNTFS ntfs defaults,dmask=0000,fmask=0111,utf8 0 0
The "fmask = 0111" will remove the "execute bit" from every file on the partition and the resulting directory permissions would be 0777 and files would be 0666.
altair thanks, I'll give it a try. This was not such a big issue, just wanted to make things a little easier...
As for the viruses, there is no disagreement, I just want to have as little as possible to do with Windows and NTFS. When and if I can find Linux stuff to do the little bit of things that still ties me to Windows, I would not hesitate to say "adios" to Mr. Gates forever.
What do I think about Window$??? Just take a look at my AVATAR...
Locked

Return to “Beginner Questions”