GoogleCloudPlatform / guest-agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guest agent creates the same user accounts using different UIDs across multi-VM deployment

deiter opened this issue · comments

Guest agent creates the same user accounts using different UID's across multi-VM deployment

Steps to reproduce

  • Create more than one project members
  • Deploy a Linux-based multi-VM environment using the same VM image (for example CentOS 7.9)
  • Check list of OS users

Expected results
The same users have the same UID's across multi-VM deployment

Actual results
All project users were created with different UIDs:

$ for i in host1 host2 host3 host4; do ssh $i 'hostname; getent passwd | tail -3'; done

host1
user8:x:1001:1002::/home/user8:/bin/bash
user1:x:1003:1004::/home/user1:/bin/bash
user9:x:1008:1009::/home/user9:/bin/bash

host2
user8:x:1002:1003::/home/user8:/bin/bash
user1:x:1004:1005::/home/user1:/bin/bash
user9:x:1008:1009::/home/user9:/bin/bash

host3
user9:x:1002:1003::/home/user9:/bin/bash
user1:x:1006:1007::/home/user1:/bin/bash
user8:x:1007:1008::/home/user8:/bin/bash

host4
user9:x:1004:1005::/home/user9:/bin/bash
user8:x:1005:1006::/home/user8:/bin/bash
user1:x:1006:1007::/home/user1:/bin/bash

Note: The previous Python-based implementation worked as expected and all users had the same UIDs.

Thanks for your issue, @deiter. In response to your report, we have never offered any guarantees about UIDs with metadata-based SSH key management. If this is a requirement for your environment, I suggest managing instance access using OS Login: https://cloud.google.com/compute/docs/instances/managing-instance-access