I have two Linux installations on my computer, with /home
on a different partition but shared for the two installs. And each install has a different username to avoid conflicts. The thing is, I'm a developer, I don't want mix users, but I want to setup permissions for a shared folder.
Example,
- Ubuntu, main user:
raul
, home folder:/home/raul
- Fedora, main user:
ricardo
, home folder:/home/ricardo
- I want a
/home/shared
whereraul
&ricardo
have permissions over this folder, maybewww-data
androot
, but any other user on any Linux distro.
I hope you got my problem.
EDIT: This seems to be more complex than expect.
This note is the best I can explain, with my actual English level, so please be nice.
On the same computer, I have distros A and B installed. Distros A and B are sharing /home
in another partition but have different users… so I have /home/a
for user A
in distro A, /home/b
and you know… So I like to have a folder for example /home/shared
where users A
and B
can both read and write to the folder, like part of the same group, BUT user A
doesn't exist on distro B and vice versa. Then how do I tell each distro to make me a group with a user from another distro?
Best Answer
Not sure exactly what your question is. Can you be more specific? Specifically, I'm having difficulty parsing
Do you want to know how to set up a shared folder/partition? If so, you could just set up a group in each installation with the same group id. Then perhaps use acl to make sure group has
rw
permission to the partition.man addgroup
saysSo you could do
where
group
andID
is the same in both installations.For a tutorial about acl see Using ACLs with Fedora Core 2, and see my answer to a recent question about sharing a directory between two users. Obviously, you'll need to mount the partition with acl support on both installations.
Once
acl
is set up, all files and directories in the folder will have group permissionsrw
and soraul
from one installation andricardo
from the other installation will both be able to read and write to that folder.EDIT: In response to raul's comment below:
If I understand your question correctly, and you are trying to share data between two
www-data
users on two installations, then this a slightly different question than the one you seemed to be asked withraul
andricardo
, because in this case, the users would be the same.www-data
would be typically created by a web server installation like apache, so creating them with matching ids would be difficult unless it was already the case (see below). I think there should be no problem in altering the uids/gids after the event to match, but I'm not 100% sure about that. Perhaps the experts here can advise.Note that Debian defaults to
uid/gid=33
forwww
. It is possible it would not be the same for other Linux distributions. However, if your installations were both the same distribution, the ids would very likely match. Indeed, if this were the case, you could just use the www-data group as your group, and you would not have to do anything.