Not sure exactly what your question is. Can you be more specific? Specifically, I'm having difficulty parsing
I want a /home/shared where raul &
ricardo have permission over this
folder, maybe www-data and root, but
any other user on any linux distro.
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
says
A GID will be chosen from the range
specified for system GIDS in the
configuration file (FIRST_GID,
LAST_GID). To override that mechanism
you can give
the GID using the --gid option.
So you could do
addgroup [options] [--gid ID] group
where group
and ID
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 permissions rw
and so raul
from one installation and ricardo
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 with raul
and ricardo
, 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
for www
. 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.
Best Answer
This script will do it (updated as per comments):
It gets the source user's groups (not including the group that's the same as their login) and shell, then creates a new user with the same shell and secondary groups.
There is no error checking, it's just a quick and dirty clone script.