Write permissions on shared partition (two or more linux distros on one computer)
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
UID & GID changed, but I can no longer access my home directory!!
Having two OSs on the same machine, I wanted to share files on a common ext3 partition. I was told to change the UID & GID so that they are the same in order to have rwx permissions from any OS and to simplify things in general. I did so. I have Mandriva and Debian. The Mandriva user was 500 and the Debian user was 1000. I changed the Mandriva user to 1000 (across the board, i.e., ...
[... I just realized that I can't even open up a terminal! ...]
i.e. ... So that uid=1000(linux) gid=1000(linux) groups)1000(linux))
What happened!? How can I correct this problem? I saved all of my data, so it's not that big a deal. I could start all over and create new user accounts, deleting the ones that aren't working properly.
usermod -u 1000 username
groupmod -g 1000 groupname (or username, not sure, they were the same)
usermod -g 1000 username (or groupname?)
When omitting the second step (groupmod -g), I got an error message.
Also, once I had changed everything, Mandriva acted really weird. I couldn't access any of my directories or files, I couldn't even open a terminal! When I logged in and logged out, things were better, however, only when I restarted my computer did things go back to normal.
I then tried editing documents from both OSs (Mandriva and Debian) which were saved on the same shared ext3 partition. It worked like a charm.
Now, this is fine for my partition and my files. How about other users? There will be no separate data partition for other users, but it would be nice to be able to switch OSs and to rwx from any OS. If I simply give each user the same UID and GID, would that make this possible? How about desktop settings and so on? Or would it be better to give each user a separate UID for each OS but identical GIDs? I'll have a look on the Net of course, but I imagine that my setup is not at all typical and that I won't find a clear answer anywhere. Who would want to set up so many OSs on the same computer? I'm doing it as a sort of an experiment. It's not really an ideal setup. I eventually want to add yet a third linux OS.
You may need to install a package to get the setfacl and getfacl utilities. I think it is the "acl" package. You can use your package manager to find out for sure.
Also, you can only use them on files and directories in a filesystem that supports acls. Ext3 and reiserfs do.
Read the manpages and the examples in /usr/share/doc/packages/acl/ to learn how to use the commands.
Suppose that you have a directory owned by "mike". Mike wants to let "sally" read files in it; joebob read and write files in it; and members of the mikefanclub group to read files in it. All other users should be denied access. Using setfacl, mike can create permissions for these particular users.
---
If you change your own UID, make sure that you log out as a regular user first. That could be a problem you are having.
---
Since you have this partition mounted in your home directory, you could simply use "chmod o+rwx ~/lindata". Now when you boot into the other distro, even though the filesystem is owned by someone else, you can read and write files in it.
If you do this, make sure that your home directory isn't world readable. Mandriva creates a default group by the same name as the user, so as long as the 'o' permissions are masked out as in "rwxrwx---" (770). This will prevent other users from access files on ~/lindata because they can't reach it. You may need to add "umask 000" to your .profile script so that new files will be readable when you boot up in the second distro. This will create new files with full permissions.
Please disregard post #16. After writing it, I couldn't find it, so I thought it didn't register. I then wrote post #17... As regards post #16, when I rebooted my computer everything was back to normal.
Thanks for the reply jschiwal. I did notice another problem. In Debian, when I mounted the lindata partition, a "DATA" icon appeared on the desktop (not my doing!). I thought to myself: 'cool', I can access the lindata directory from the desktop or my home directory (I mounted it onto a directory called lindata in my home directory). I then realized that all users had access to 'lindata' and its contents! Crap! How can I make it so that that default "DATA" icon doesn't appear when creating a new user, and, more importantly, what do I have to do to make it so that nobody has access to my lindata directory?
jschiwal, your post is a little over my head, I'll have to reread it a few times and do a little more research. I'm not a newbie, but I'm not a veteran yet either... I do like a challenge though, so thanks for the info, and I'll post back when I have something new to report...
Please disregard post #16. After writing it, I couldn't find it, so I thought it didn't register. I then wrote post #17... As regards post #16, when I rebooted my computer everything was back to normal.
In Debian, when I mounted the lindata partition, a "DATA" icon appeared on the desktop (not my doing!).
If the desktop displays devices, then I don't think you can stop it from showing up. You need to rely on the permissions of the filesystem to deny access. This wrinkle means that your UID and GID for FC6 can't have a corresponding regular user in Debian, but since Debian starts UIDs at 1000, that shouldn't be a problem and is already the case. ( This is a partition on an internel drive isn't it? )
The manpages for chmod and chown, and the coreutils info manual will be what you need to read to understand permissions. For the getfacl/setfacl programs, look for the README file that comes with installing the package.
Also look at the "id" command to print out the username, group names with their corresponding UID & GID values.
Running SuSE 10.0 on an ordinary PC.
Installed Fedora 8 on the second hard drive.
Same username on both distros.
Couldn't access the home directory on the second hard drive from SuSE.
Checked the UID with the command id and found out that they were not the same on the two systems.
Changed the user and group-id in Fedora to match the ones in SuSE.
Code:
usermod -u 1000 brons
usermod -g 100 brons
Here's the problem:
When I then boot in Fedora and try to log in, KDE doesn't work properly.
I get a lot of error messages and the desktop is all messed up.
"An error occurred while loading or saving configuration information for ..."
When I reset the values of the user and group-id, KDE works just fine again.
I suppose KDE is unable to read some kind of profile, but how do I fix this?
Is it a possible solution to remove the user on the Fedora system and create a new one with the same UID as on the SuSE-system? If so, how do I do that?
I would be grateful for any help, as I'm just an ordinary Linux-user and not familiar with this kind of stuff.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.