When trying to do: ssh -oBatchMode=yes -4 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

ssh fails when the password of the remote linux user starts with a special char(for example !Passw0rd) and shows the following error: "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)"

When creating a user with password such as Passw0rd! it works properly.

  • 2
    What exactly is your question?
    – Ramhound
    Dec 9, 2020 at 14:12
  • how can it be solved? why it happens?
    – Qknow123
    Dec 9, 2020 at 14:52
  • 1
    There's something fishy. The permission denied message does not mention password. It mentions publickey; this method can ask for the passphrase. And it mentions gssapi-*; this one I don't know, but it seems it shouldn't ask. Anyway, the password method was not used. So maybe you were asked for something else. Or maybe the question contains misleading or incomplete information. Dec 9, 2020 at 20:08

1 Answer 1


I am not sure, but I have tried your example on my RHEL 7 servers running openSSH version 7.4pl-16 and I did not have any error using same password as you starting with !...

Maybe you have a typo with the password or keyboard settings? Try to use scp for example and confirm if the problem still exist even using scp?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .