2

I am maintaining a samba server for an office environment. So far, whenever there had to be a new user, I called the person over and let him type in his samba password on my console, after I typed smbpasswd -a username. I don't want to know any of the passwords.

For the unix passwords, I just let them create a password digest (e.g. http://www.askapache.com/online-tools/htpasswd-generator/) in advance and edit the password file later with vipw -s.

Now I have a remote colleague who can't come over to type in his password, but I still don't want to know it at all.

How can I edit the samba password without actually knowing the password itself, but just a digest?

1

Let him send you pass.txt which contains his plain password encrypted by GnuPG.

echo "secret-samba-password" | gpg -ca --cipher-algo AES256 >pass.txt

Then you can blindly decrypt pass.txt and feed it to smbpasswd in the script:

PASS=$(gpg -qd pass.txt)
(echo $PASS; echo $PASS) | smbpasswd -sa username

As example above you can use symmetric encryption (gpg -c) with a temporary passphrase shared beforehand, but public key encryption against your key is much more desirable at the actual practice.

  • That is a really good work around! I like it very much and gonna do it that way! But I could still see the password once it's not encrypted anymore. Is there no way to do it so that I wouldn't even be able to see the password, ever? – Preexo Jun 2 '15 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.