I am on a Mac using iTerm2 and zsh v5.7.1. When I login from my local computer to the remote computer using 'ssh', most of the characters are repeated at the prompt as I type. Clearing the line with Ctrl-L displays the correctly typed input. I am reasonably sure this is an issue of my prompt using UTF-8 and Esc characters. If I immediately run 'bash' after logging in, I have access to a prompt without special characters, and thus no repeating characters. My standard prompt is Powerlevel10K.


buckley@dusky   ~  eecechecho ""EExxrrtr x xttrraa cchhaaaa arraaccttrt teerrss" buckley@dusky   ~  echo "Extra characters"

I obviously do not see these extra characters when I am using that 'remote' computer locally, but only when I 'ssh' into it.

I am hoping someone can point me to the offending file or command, such that 'ssh' properly recognizes the remote login environment and prompt.

  • This post might explain the problem, if it's indeed the prompt. – harrymc Nov 6 '19 at 18:44
  • Partially resolved. The issue was the "TERM=xterm-256color-italic" is not working when trying to remote in with 'ssh' even though my login is properly using TERM=xterm-256color-italic when I am local on that computer. I need to figure out how to add this italic flavor of TERM to the system. For now, I am using the following (alias'd) command to ssh in: "TERM=xterm-256color ssh username@remotehost" – Buckley Jan 13 '20 at 18:56

Your prompt contains Unicode characters but LC_CTYPE on the remote machine is not UTF-8. You can confirm this by typing locale | grep LC_CTYPE.

To fix this, you first need to ensure the desired locale is installed on the remote machine. Type locale -a to see the list of installed locales. If the locale you want (which is probably the same locale you are using on your local machine) is missing, you need to install it. The specific command to do so depends on your the OS and distribution of the remote machine.

Then you either need to instruct sshd to accept locale environment variables from clients (man sshd_config and search for AcceptEnv) or manually set LANGUAGE in ~/.zshrc of the remote machine.

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.