# [SOLVED]Gentoo and Ubuntu - Same user permissions?

## willie_wang

Yeah, I just read the title, s'abit confusing, but here's what I mean.

I have a Gentoo partition and as soon as the new Ubuntu comes out next week, I'll be installing that on my other partition I've reserved for it. Ok. I also have a /home partition with a user directory called "willie" (named after the user set up on my gentoo install)...

I'm obviously a bit of a noob to all this security stuff, but how do I set it so that when I install Ubuntu, both users can access the same home folder with read/write/execution permissions to that same folder?

Any ideas? Help'd be much appreciated! ~wwLast edited by willie_wang on Sun May 18, 2008 8:26 pm; edited 1 time in total

----------

## BradN

Well, here's the thing... filesystems don't store user names in association with files and such, they store the user numbers (uid) instead.  So the thing you'll want to make sure of, is that your usernames have the same ID numbers between gentoo and ubuntu.  Other than that, things should work pretty spiffy.

----------

## willie_wang

 *BradN wrote:*   

> Well, here's the thing... filesystems don't store user names in association with files and such, they store the user numbers (uid) instead.  So the thing you'll want to make sure of, is that your usernames have the same ID numbers between gentoo and ubuntu.  Other than that, things should work pretty spiffy.

 

Yep, I thought that was the case. Thanks BradN. Any chance you can give me a command to change the uid of a user or explicitly tell gentoo/ubuntu to add a user with a certain uid?

Thanks  :Smile: 

----------

## tarpman

 *useradd(8) wrote:*   

>        -u, --uid UID
> 
>            The 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
> ...

 

----------

## willie_wang

 *tarpman wrote:*   

>  *useradd( wrote:*          -u, --uid UID
> 
>            The 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
> ...

 

Fantastic! You're the man, tarpman!  :Very Happy: 

----------

## BradN

root:x:0:0:root:/root:/bin/bash

this is a line from /etc/passwd:  the first number is the user ID, the second number is the group ID.

Actually, you want to make sure both of those numbers are the same between the two operating systems for the actual users, and you should just be able to edit that in /etc/passwd.

/etc/group contains the group information, which is similar and only has one number to change.

You probably don't want to change any of the stuff that's not for actual added users, since there could already be data on the root partition that references the old numbers.

This only applies if you create the users beforehand - if you create them after installing ubuntu, you can use tarpman's hint and specify the userid and groupid with the useradd and groupadd commands.

----------

## desultory

Instead of specifying the uid of the user and the gid of their default group manually, you could use usermod and groupmod to change them after installation.

----------

## willie_wang

Woohoo! What would I ever do without you guys?

Thank you all so much! ~ww   :Very Happy: 

----------

## tarpman

 *desultory wrote:*   

> Instead of specifying the uid of the user and the gid of their default group manually, you could use usermod and groupmod to change them after installation.

 

Then there's just the matter of cleaning up existing files to match the new IDs.  It's doable, for sure, but I prefer making sure the ID is correct before it's ever used.

----------

## BradN

Yes, that could be a problem if you create the account using ubuntu's installer... I'm not sure if it's smart enough to alter the /home/x permissions, but if it is, there'll be some chown'ing involved to set things back.

----------

## willie_wang

How about using the installer and creating a user during installation (eg. fakeuser), and then once ubuntu is installed, creating the intended user - in this case, willie - using the command line and specifying the user id, without creating the home directory?

----------

## desultory

 *tarpman wrote:*   

> Then there's just the matter of cleaning up existing files to match the new IDs.

 That should only be necessary outside of the home directory, usermod should handle any alterations from the old Ubuntu uid to the shared uid inside of the home directory.

 *tarpman wrote:*   

> It's doable, for sure, but I prefer making sure the ID is correct before it's ever used.

 If the first login is done on a terminal and is used to handle the modifications that should not be much of a problem, even so avoiding such problems entirely would be better still.

 *willie_w wrote:*   

> How about using the installer and creating a user during installation (eg. fakeuser), and then once ubuntu is installed, creating the intended user - in this case, willie - using the command line and specifying the user id, without creating the home directory?

 If you set all of the group settings and sudo permissions of the willie account to match the user created by the installer that approach is probably the easiest and safest. It also has the benefit of creating a user which can be used to do testing in a somewhat simpler setting than a mature user account.

----------

## DarKRaveR

You should be warned: Though setting the exact same user up in both distributions, by giving them the same gourp membership and user id, you might run into some unexpected problems (which of course can be overcome).

Mainly all user specific setting are in the users home folder, including some entries in the menu of your desktop, which applets are loaded etc. . Naturally ubuntu & gentoo don't necessarily come with the same apps installed, nor same default settings, which results in effects like having menu entries but the app is not installed, having your desktop environment run applets, which are not there in one of the distros. All this can be avoided, if at all times, you pretty much have the same apps installed in both, or rather the equivalent packages - This can be pretty annoying work.

Although gentoo tends to generally not touch ~/ as a policy, other distros might do exactly that, which does result in unwanted or unexpected behavior.

I lately tried to setup gentoo+fedora+opensuse, with a common boot and a shared user home, which was hell of annoying, if you setup something with distri A, distri B suddenly modifies grub.conf in a way, you wouldn't expect. Some don't change it at all, if you just don't install grub for example - The annoyance is, that most distributions just have no plan for such a setup, which often means, you would have to do all by hand ...

To sum it up: Prepare for unexpected and ugly behavior and some things just going plain wrong in the first place. If you have fun fixing things and forcing each distribution into exactly doing what you want, give it a shot.

----------

## K T A

 *DarKRaveR wrote:*   

> Although gentoo tends to generally not touch ~/ as a policy, other distros might do exactly that, which does result in unwanted or unexpected behavior.

 

I second that! You better backup your home partition before you install any other distro - a friend of mine messed his home pretty well installing opensuse...

KTA

----------

## willie_wang

 *K T A wrote:*   

>  *DarKRaveR wrote:*   Although gentoo tends to generally not touch ~/ as a policy, other distros might do exactly that, which does result in unwanted or unexpected behavior. 
> 
> I second that! You better backup your home partition before you install any other distro - a friend of mine messed his home pretty well installing opensuse...
> 
> KTA

 

Pah. Ok. Another idea - creating a common shared folder for both users which stores all the documents and music etc. When the final ubuntu arrives next week, I'll have a go at this and let you all know how it goes.

Thanks for all your help! ~ww

----------

## BradN

It should be safe to symlink the Desktop folder so they both use the same one - that should help improve the uniformity of the whole setup a bit.

----------

