Disclaimer: I'm creating a quick and dirty script for my own personal use, I'm aware that this isn't the correct way to do things.

I want to initialize a kinit on a remote host (no keytab available).

When I do this locally, it works fine.

kdestroy; echo superstrongpassword | kinit myusername@REALM.COM

But I can't seem to be able to run the same thing over ssh.

ssh -q -tt hostname.com "kdestroy; echo superstrongpassword | kinit myusername@REALM.COM"
  • There is always the possiblity to use public key authorization to just not require passwords? Also you could add commands that require root/sudo rights to the sudoers file and use the NOPASSWD for that specific command. – Ziazis Jul 7 '17 at 9:29
  • I'm not the admin of these nodes, so no adding things to files allowed. It's also about the kinit, not the ssh password – Havnar Jul 7 '17 at 9:29
  • Oh, well why is a keytab then not available? That would be the better solution to anything else. Try setting one up, usually with kutil. Like you said it's a dirty way how you are trying to do it and that is exactly why kinit doesn't support such things. – Ziazis Jul 7 '17 at 9:48
  • What does not work? What errors you get? What you expect? – Jakuje Jul 10 '17 at 12:06
  • I expected it to "just work" like described. I ended up using a keytab in the end. But for the sake of answering this question or future reference I would still like to know how to "pipe a password to kinit over ssh" – Havnar Jul 12 '17 at 7:28

Your Answer

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

Browse other questions tagged or ask your own question.