MacOS 的更新是 Mac 的賣點之一,修正了系統的錯誤 + 提供新功能 +滿足公司資安要求
*** Issues and Fixes ***
Issue 1: 登入 ssh 連線時出現 LC_TYPE 錯誤。
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
manpath: can't set the locale; make sure $LC_* and $LANG are correct
修正方式:
- 修改 /etc/ssh/ssh_config
將 Host *下方的 SendEnv LANG LC_* 註釋取消
Issue 2:
ssh 很快就自動斷線
修正方式:
同樣是修正 ssh_config 檔案,將 Host * 這段下方加上
ServerAliveInterval 60 # To prevent a session from disconnecting after idle
AddKeysToAgent yes # Must add on macOS 10.12.2 and above. Detail see here
UseKeychain yes # Must add on macOS 10.12.2 and above. Detail see here
StrictHostKeyChecking no # Do not show the fingerprint of the public key
IdentityFile ~/.ssh/id_rsa # Private key file to forward
=== English Version ===
Updating MacOS provides the following upsides:
- Bug Fix & Security Patches
- New Functions
- Being compliant to the security requirement from the IT department.
However, it may also introduce some issues after the update is deployed, the followings are the corresponding handle/fix for the issues.
Issue 1. The LC_TYPE error while making a ssh connection to the remote server.
ex: -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Ans: You can fix this by modify you /etc/ssh/ssh_config file, which is the system-wide ssh connection setting of your MAC. By doing this, you need to comment the line of the 'Host *' section .
# SendEnv LANG LC_*
After it, you can connect your server with no such warnings.