2

I have a script that works fine on Centos because useradd doesnt require a password to be set there and then, but the same script doesnt work on ubuntu servers as it requires this info.

I ideally want to force no password set on my script for the ubuntu servers or add a line where it sets the password during the useradd command.

If I just add sudo passwd user to my script this will only take effect after the useradd command which is too late.

Any ideas?

Matt B
  • 117

1 Answers1

1

From man adduser:

--disabled-password
Like --disabled-login, but logins are still possible (for example using SSH RSA keys) but not using password authentication.

The default behaviour on useradd is to disable the password, so that one should already work.

Dale C. Anderson
  • 647
  • 2
  • 7
  • 13