Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible equivalent of "passwd -l"

Tags:

linux

ansible

I'm trying to lock a user account that I just created with Ansible (it should not be possible to log into this account). I know you can do this using the shell module by running "passwd -l".

Is there a way to do this via the user module, or something similar?

like image 694
fluffels Avatar asked Oct 16 '25 17:10

fluffels


1 Answers

I think that's not possible.

Maybe the following is an option?

 - user: 
     name: someone
     shell: /sbin/nologin

I think this is even more secure than using passwd -l as the latter would only disable the password. The user would still be able to login by ssh key authentication.

like image 133
udondan Avatar answered Oct 19 '25 06:10

udondan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!