The Samba-Bugzilla – Bug 1795
"smbpasswd -s -m" cannot change computer password
Last modified: 2006-04-20 07:57:48 UTC
Until changes made in 3.0.6, one could change the password of a computer account
using "smbpasswd -m host password". Now that support for giving the password in
the command line was removed for some reason or other, this of course is no
longer possible. Unfortunataly, using stdin for passwords does not work with
computer accounts. E.g.
# smbpasswd -s -m hostname
Failed to set password for user hostname$.
Failed to modify password entry for user hostname$
without even asking for a password.
It does work for users, but when doing
# smbpasswd hostname$
instead, the workstation flag is changed to a user flag, requiring a
# smbpasswd -e -m hostname
So, apart from asking you to try and not change command line syntax from one
minor version to another, it would be good if you treated a computer account the
same as a user account in this regard, as there are quite valid reasons why one
would need to set computer passwords to arbitrary values.
(echo password; echo password) | smbpasswd -s -m machine
(In reply to comment #1)
> (echo password; echo password) | smbpasswd -s -m machine
Are you sure you actually tried in v3.0.7? I did, and all I get is:
# useradd machine$; smbpasswd -a -m machine
Added user machine$.
# (echo secret; echo secret) | smbpasswd -s -m machine
Failed to set password for user machine$.
Failed to modify password entry for user machine$
stdin does work for users, not for machine accounts. If I've missed something,
please let me know. Thanks.
Jeremy, since you are the one who removed this beahvior, i'm
going to let you deal with this. I've already handled several
reports relating to it on the mailing list.
Just a quick question: What are you using this for? Machine passwords are set
upon account creation. They are usually not set manually. A machine changes it
(In reply to comment #4)
> Just a quick question: What are you using this for?
I know the mechanism behind machine accounts. We need this for cloning Windows
installations (there's one image, computers are cloned during PXE on every start
(self healing), machine accounts are set to random values on server and client,
and then the actual OS starts; compared to other imaging systems like Ghost,
there's no reboot or manually re-joining a domain necessary).