LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 10-30-2018, 10:27 AM   #1
sllinux
Member
 
Registered: Feb 2009
Posts: 45

Rep: Reputation: 16
When using cloud-init, what order are the users created in?


I am using cloud-init to initialize a RHEL Atomic Host VM.

I have the following as my user-data file:

Code:
#cloud-config
groups:
  - ourgroup
users:
  - name: muser
    primary_group: ourgroup
    lock_passwd: false
    sudo: ALL=(ALL) NOPASSWD:ALL
    ssh_authorized_keys:
      - ssh-rsa [REDACTED]
  - name: auser
    primary_group: ourgroup
    passwd: [REDACTED]
    lock_passwd: false
    sudo: ALL=(ALL) NOPASSWD:ALL
ssh_pwauth: True
When the VM boots up for the first time using an ISO file generated from that user-data file, the users are created. From what I see in /etc/passwd, the "auser" user is created with UID 1000, and the "muser" user is created with UID 1001.

We are deploying some software on this VM that needs to know the UID of "muser" in advance prior to installation. (This is due to needing to create a Docker image on a machine that's different from the machine where the software will be installed.) Whenever a VM is deployed using that ISO file, will "muser" always be created after "auser" (and therefore "muser" will always have UID 1001)?

I thought maybe the users were created in either alphabetical order or in the reverse order in which they are listed in the user-data file, so I created another user-data file with 4 users to test that theory. But that theory failed, and I could not tell in what order cloud-init creates the users.

If no one knows what order the users are created in, can I at least assume that "muser" will always have a UID of 1001?
 
Old 10-30-2018, 11:42 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I haven't done cloud-init at all but this post seems to suggest you can specify uid (and maybe gid) in your config file so you always assign the ones you want rather than worrying about what it would pick at random. It does note you have to put quotes around the values specified.
 
1 members found this post helpful.
Old 10-30-2018, 04:50 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by MensaWater View Post
I haven't done cloud-init at all but this post seems to suggest you can specify uid (and maybe gid) in your config file.
This is confirmed by the documentation.

Now, the users key has a list of users as value, which could mean that users are created in the list order. However, the documentation doesn’t mention this.
 
1 members found this post helpful.
Old 10-30-2018, 05:31 PM   #4
sllinux
Member
 
Registered: Feb 2009
Posts: 45

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by MensaWater View Post
I haven't done cloud-init at all but this post seems to suggest you can specify uid (and maybe gid) in your config file so you always assign the ones you want rather than worrying about what it would pick at random. It does note you have to put quotes around the values specified.
Thanks, adding uid worked, although as mentioned in that post, there is a bug so you have to put it in quotes like:

uid: "1001"
 
1 members found this post helpful.
Old 10-31-2018, 08:30 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Glad I could help. If you don't mind, please go to thread tools and marked this as Solved. It helps others in future more quickly find posts with solutions.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging log files in the created order Santhoo87545 Linux - Newbie 5 09-30-2017 11:54 AM
LXer: Using cloud-init to initialize Fedora Cloud VMs on oVirt LXer Syndicated Linux News 0 03-27-2017 10:45 AM
[SOLVED] order of init services mahmoodn Linux - Server 7 05-06-2011 12:50 AM
LXer: Ubuntu’s Cloud-Init Promotes Customization in the Cloud LXer Syndicated Linux News 0 01-06-2011 10:30 AM
mp3's created with kaudiocreator play in wrong order MartyJay Linux - Software 14 10-31-2008 06:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 11:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration