Unable to change UID using salt

137 views
Skip to first unread message

Jeevan Reddy

unread,
Aug 31, 2023, 11:35:57 AM8/31/23
to Salt-users
Hi,

I am trying to change a UID to a static one for a group of users and when I apply the salt state I see an error Comment: These values could not be changed: {'uid': 20000} Code:   jreddy:
    fullname: Jeevan Reddy
    groups:
      - noc
    uid: 20000

salt state init.sls file:
user.present:
  - name: jreddy
  - fullname: Jeevan Reddy
  - home: /home/ jreddy
  - gid: {{ salt['file.group_to_gid']('users') }}
  - uid: 20000
  - allow_gid_change: True
  - allow_uid_change: True

After applying the salt state I see the below error:
---------- ID: noc_jreddy Function: user.present Name: jreddy Result: False Comment: These values could not be changed: {'uid': 20000} Started: 12:08:22.066106 Duration: 37.808 ms Changes:

My question is when we set this flag allow_uid_change to True then salt should be able to change the UID right?

Regards,
Jeevan.

Raf Czlonka

unread,
Aug 31, 2023, 12:20:59 PM8/31/23
to salt-...@googlegroups.com
On Thu, Aug 31, 2023 at 03:25:29AM BST, Jeevan Reddy wrote:
> Hi,
>
> I am trying to change a UID to a static one for a group of users and when I
> apply the salt state I see an error *Comment: These values could not be
> changed: {'uid': 20000} Code: *
>
>
>
> * jreddy: fullname: Jeevan Reddy groups: - noc uid: 20000*
>
>
> *salt state init.sls file:*user.present:
> - name: jreddy
> - fullname: Jeevan Reddy
> - home: /home/ jreddy
> - gid: {{ salt['file.group_to_gid']('users') }}
> - uid: 20000
> - allow_gid_change: True
> - allow_uid_change: True
>
>
> *After applying the salt state I see the below error:*---------- ID:
> noc_jreddy Function: user.present Name: jreddy Result: False Comment: These
> values could not be changed: {'uid': 20000} Started: 12:08:22.066106
> Duration: 37.808 ms Changes:
>
> My question is when we set this flag *allow_uid_change **to *True then salt
> should be able to change the UID right?

Hi Jeevan,

Salt won't make any changes if the user's logged in - make sure you had
logged out.

Regards,

Raf

Jeevan Reddy

unread,
Aug 31, 2023, 2:16:58 PM8/31/23
to Salt-users
Hi,

Thank you for your reply. I figured out the issue and it was due to some bad config from my side. Its working now thank you.

Regards,
Jeevan.

Phipps, Thomas

unread,
Aug 31, 2023, 3:16:56 PM8/31/23
to salt-...@googlegroups.com
what was the bad configuration?


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/51aead2b-da5d-42b6-87d6-5d766215d26bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages