I have two ubuntu servers that share home directories. The /home directory from server1 is mounted as the /home directory on server2. I have a problem when trying to give a new person access to both servers. I use the adduser command on each server with the same user name. However the UID does not match when I do this, thus the user ends up not having permission to files in their home directory when it is accessed with the account from server2.
On server 1 where the user was created along with his home directory. (Things look okay)
selah@server1:~$ tail -n 2 /etc/passwd
dfulgon:x:1083:1087:,,,:/home/dfulgon:/bin/bash
swartp:x:1085:1089:,,,:/home/swartp:/bin/bash
selah@server1:~$ ll -a /home/dfulgon | tail -n 3
-rw-rw---- 1 dfulgon dfulgon 25 Jun 2 13:41 .my.cnf~
-rw-r--r-- 1 dfulgon dfulgon 675 Jun 2 13:35 .profile
drwxrwxr-x 2 dfulgon dfulgon 4096 Jun 2 14:27 .ssh/
On server 2 where a user account with the same name was created but the home directory from the other server is used: (Permissions are messed up, pointing to the wrong user)
selah@server2:~$ tail -n 2 /etc/passwd
bslf:x:1083:1087:,,,:/home/bslf:/bin/bash
dfulgon:x:1087:1091:,,,:/home/dfulgon:/bin/bash
selah@server2:~$ ll -a /home/dfulgon | tail -n 3
-rw-rw---- 1 bslf bslf 25 Jun 2 13:41 .my.cnf~
-rw-r--r-- 1 bslf bslf 675 Jun 2 13:35 .profile
drwxrwxr-x 2 bslf bslf 4096 Jun 2 14:27 .ssh/
Is there a good way to overcome this problem while maintaining the convenience of shared home directories?