2

On my MacBook with macOS Big Sur and US-International PC as an input source, I am trying to connect by SSH client to remote computer that has a caret ^ (Shift+6) inside it's SSH password.

  • There is a key icon shown, and connection always fails, bad password.
  • After removing a caret from remote computrer password the connection is successful. So the caret is a problem reason for sure.
  • When typing password’s caret there is some sound like beep, bell, so caret probably has some special function that I do not about and want to turn off.
  • Typing caret inside classic terminal lines (outside of hidden password input) also has non-standard behavior, for example 'caret then a' shows 'a' with accent, without bell sound.

So how to turn off accents or something more that cause the problems? Or how to type it without changing settings (Double caret not working).

Asain Kujovic
  • 181
  • 1
  • 7
  • 1
    What happens if you try to cut and paste the password? Could you use ssh keys instead of a password? (Yes, that doesn't answer your question...) – dirkt Aug 11 '21 at 02:56
  • @dirkt checked now, if i enter caret by typing "caret caret backspace" somewhere and then copy paste it, it is wrong caret 'ˆ' instead of '^', but it is good idea and works well if i copy caret from web. – Asain Kujovic Aug 11 '21 at 03:19

2 Answers2

2

The better solution is to switch from the "US International - PC" input source to plain "US". If you enable multiple input sources (in System Preferences -> Keyboard pane -> Input Sources tab), you can select "Show Input menu in menu bar", and you'll get a menu bar item that lets you switch between them on the fly.

EDIT: the following method turns out not to work in many password entry situations, including ssh. So it's not useful in this particular situation, but I'm leaving it in case someone finds it useful in other situations.

If you are stuck with "US International - PC" and need to type one of the characters that it treats as a combining accent, just follow it by pressing the spacebar.

That is, in "US International - PC" mode:

  • ^a = "â"
  • ^E = "Ê"
  • ...etc...
  • ^Spacebar = "^"

The same applies to all of the other keys that "US International - PC" treats as combining accents: ~, `, ', and " -- if you want them as plain characters, follow them with a press of the Spacebar.

Gordon Davisson
  • 34,084
  • 5
  • 66
  • 70
  • 1
    i would mark this answer as correct, but as far i know i have tried many many times 'caret then spacebar'. And it works in other inputs, but alwais failed inside ssh password prompt (there is also bell diference). – Asain Kujovic Aug 11 '21 at 20:18
  • @AsainKujovic You're right, I hadn't tested it for password entry. It looks like it fails for a variety of password inputs (i.e. situations where what you type isn't echoed, including `read -s`), not just `ssh`. In fact, I can't find a way to use those keys to type accented characters into those password fields either! I'll leave the answer in case it's useful in other contexts, but add a note about the limitation. – Gordon Davisson Aug 11 '21 at 21:32
1

I found an answer that solved the problem finally in this link by user tertium on Stack Overflow.

The same problem is at any password input on web too.

Solution like the link says is: Use “U.S.” instead of “US International - PC” keyboard input source.

For temporary solution without changing settings, as user dirct suggested in comment, copying caret from web and Command+V pasting to SSH password input works well too. copy-paste source can not be own text typed with two caret and backspace, because it is wrong UTF char ˆ instead of correct ^.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Asain Kujovic
  • 181
  • 1
  • 7
  • 1
    International PC is really a layout to avoid, unless you want to copy the behaviour of Windows International PC layout… which also has those irritating "live" keys rather than proper dead-keys for accents. Just avoid unless you really know you need it for something very specific. This is true even if you use a PC keyboard on a Mac. – Tetsujin Aug 11 '21 at 17:24