เชื่อมต่อด้วย SSH จาก macOSไปยัง Linux แล้วมีข้อความเตือนที่เกี่ยวข้องกับ LC_CTYPE

Damrongsak Reetanon
MFEC
Published in
2 min readFeb 26, 2019

ทุกครั้งที่เชื่อมต่อจาก เครื่อง mac จากค่าย apple ซึ่งทำงานด้วยระบบปฏิบัติการ macOS ไปยัง CentOS จะพบข้อความเตือนว่า warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory ทุกครั้งที่เชื่อมต่อ

tychemini:one.lab drs$ ssh centos@b2.example.com
centos@b2.example.com's password:
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[centos@base2 ~]$

แนวทางการแก้ไข ทำได้ไม่ยาก

  1. [ at macOS] แก้ไข /etc/ssh/ssh_config โดย comment (#) บรรทัดที่มีข้อความ SendEnv LANG LC_*
tychemini:one.lab drs$ sudo vi /etc/ssh/ssh_config#       $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
----------- truncated output -----------# Site-wide defaults for some commonly used options. For a
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
Host *
# SendEnv LANG LC_*
# XAuthLocation added by XQuartz (http://www.xquartz.org)
Host *
XAuthLocation /opt/X11/bin/xauth

2. [at macOS] ทดสอบการเชื่อมต่อจาก macOS ไปยัง Linux server ปลายทาง จะไม่พบข้อความเตือนที่เกี่ยวข้องกับ LC_CTYPE

tychemini:one.lab drs$ ssh centos@b2.example.com
centos@b2.example.com's password:
Last login: Wed Feb 27 00:25:47 2019 from mini.example.com
[centos@base2 ~]$
Writer By Mr. Damrongsak — MFEC PEOPLE

--

--