Ask Your Question
0

Does puppet allowed changing username?

asked 2016-12-02 02:09:12 -0500

Mehrdad gravatar image

Hi,

We have a new company policy regarding username and therefore I have to change all linux username. I wonder if I only could change this:

@users::virtual::localuser { 'old_username':

to:

@users::virtual::localuser { 'new_username':

Thanks, Mehrdad

edit retag flag offensive close merge delete

Comments

1

puppet is declarative.. I'm not sure if you can rename a user. What you would be doing is removing the old user and creating the new user with the values that you need.

DarylW gravatar imageDarylW ( 2016-12-02 13:08:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-12-05 15:04:16 -0500

updated 2016-12-06 13:18:20 -0500

You can't. The account new_username gets reflected as useradd new_username.

In theory usermod --login new_username --home /home/new_username --move-home old_username could rename the user.

The problem is, PP has no definitive way to determine, whether a user was created on puppet's will. There's a chance, you manually created old_username on one machine. You'll have to manage two user resources (old_username becomes absent, new_username is present).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-02 02:09:12 -0500

Seen: 316 times

Last updated: Dec 06 '16