0

I recently installed Debian 9.0 stable with KDE in my notebook that already had an Ubuntu and windows 10 installations. My intent was to create a new partition to debian's root and use the same /home/daniel partition as i was using in my Ubuntu. Though i forgot to use an equal user name and later created a new user(with the KDE's GUI app) in Debian with my Ubuntu's user name(daniel). The first user can login without freezing to the GUI though my new can only through the tty.

I already tried the following solutions:

  • Change the /home/daniel directory permissions (I had none but adding them wasn't enough) .

    sudo chmod 755 /home/daniel

  • Include my user to the same groups that the first user belonged to like sambashare, sudo and lipadmin (it belonged to none originally).

    sudo usermod -a -G lipadmin,sambashare,sudo,... daniel

  • Changing the user and group for my user's folder, running it recursively made me have to change it in my ubuntu install because the users and groups changed to "101" when i booted through it.

    chown -R daniel:daniel /home/daniel

When i booted my ubuntu and the user for the files changed to 101, i wasn't able to enter the GUI either. But i fixed this with chown -R daniel:daniel /home/daniel run on ubuntu's tty.

  • Show, as indented text, the commands that you did run. – Basile Starynkevitch Nov 16 '17 at 5:55
  • Notice that I edited my answer to improve it. Read all of it, and be very careful. Your Debian and Ubuntu systems are in a dire state. What you have tried increased the mess. – Basile Starynkevitch Nov 16 '17 at 6:42
0

What matters to Linux operating systems (to their kernel thru system calls done by every programs) is not user names but user ids or uid-s. It is a small positive number (not a name), like 1234. Read credentials(7).

You need to ensure that on both your Debian and your Ubuntu the daniel user has the same uid. The daniel name is not very important (and you might want, but need not, to use a different name). Probably Debian and Ubuntu are using different uid-s/gid-s for daniel. Read also id(1) and use id -a. And use the stat(1) command on your home directory, so stat /home/daniel to understand what uid and gid it has...

I assume you can get superuser power on both OSes, e.g. by running sudo. Otherwise you need to boot from an external media in rescue mode, or boot your kernel with init=/bin/bash.

The mapping between user names and their uid-s is often done in /etc/passwd, so read carefully passwd(5) (today that /etc/passwd does not contain any password information anymore, but that file path did not change for historical reasons. See also shadow(5)). BTW, that mapping could -with care- be done otherwise (but usually is not) and how it is done is configured in /etc/nsswitch.conf (which I assume you did not change, see nsswitch.conf(5) for more)

Likewise the mapping between group names and their gid-s is done in /etc/group, so read carefully group(5).

So, first run the commands (not GUI programs, in your case they are confusing you) to understand what uid/gid is used for daniel on both Debian and Ubuntu. You probably want to run the grep daniel /etc/passwd command (see grep(1)). Likewise, run the relevant command to find your gid (on both systems).

Then decide on a common uid and gid for both systems (Debian and Ubuntu). It should be unused, and you need it to be the same (small positive number) on Debian and Ubuntu. I recommend choosing a number above 4000 but below 65000 as your common uid (and likewise for your common gid).

Be careful

Change the uid and gid by editing -as root- carefully with an editor (like vim, or emacs, or nano, etc) the /etc/passwd and /etc/group files on both systems to share the same uid/gid on Debian and Ubuntu for your user. Use sync(1) after that edition (it probably is useless, but you want to be sure that your edition goes to the disk).

(if you mess up that step, you could have some unusable system)

Then (as root) change (once) recursively the ownership of your home directory, using chown(1) command. You probably want to run something similar to chown -R daniel:daniel /home/daniel (the first daniel is a user name, the second is a group name, the third is a directory entry). After thatc consider using chmod(1) to change the permission (probably as chmod -R a-rx /home/daniel), since you should not have world-writable home or own directories (this is a huge vulnerability).

NB: prefer, for administrative tasks, to use commands not GUI

  • After running the greps on the /etc/passwd and /etc/group I realized the userid and gids for Ubuntu's daniel and the debian's first user are the same(1000), the debian's daniel is 1001. Is there a way to change an user's name safely so they can use the same home directory or the only solution is changing the user ids in both installations? – Zeor137 Nov 16 '17 at 22:15
  • @Zeor137 Renaming and moving the home of an user is done by usermod -m -d "/home/new_home" -l new_login old_login. The modified account must not be in use. For this case, you should boot debian's rescue shell, remove daniel userdel daniel, rename your first account to daniel, and merge manually both homes. – user285259 Dec 25 '17 at 23:52
  • @basile You made an annoying mistake ! You meant chmod o= /home/daniel not chmod -R a-rx /home/daniel . – user285259 Dec 25 '17 at 23:57
0

You currently share the home between both daniel users on Ubuntu and Debian ! What is happening is this user have uid 1000 on Ubuntu, but 1001 on Debian. The folder was created by Ubuntu, so it is owned by 1000. Thus daniel on Debian can write absolutely nothing to his home, which prevent graphical login.

Sharing the home is theoretically possible but leads to a mess, i do not recommend it. What is your aim ? I guess you want to share your data (Documents, Pictures, ...), not applications config. So you will find the solution here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.