How to solve the problem of garbled characters when JumpServer connects to Linux assets?

Official website address: JumpServer - Open Source Bastion Host - Official Website

Online phone: 400-052-0755

Technical support: JumpServer technical consultation


1 Overview

When using JumpServer to connect to assets, users may encounter the problem of garbled Chinese characters in Linux assets. This article mainly describes how to solve the above problems.

2. Introduction

The default encoding used by JumpServer for Linux platforms is UTF8.

The default system encoding method of Linux is also UTF8.

3. Problem Analysis

There are encoding methods in the JumpServer platform, and there are also encoding methods in the Linux system. Therefore, the solution can generally start from two aspects. On the one hand, modify the coding method of the system platform of JumpServer, and on the other hand, modify the coding method of Linux itself.

4. Solutions

4.1 Modify JumpServer

Newly create a system platform in "Console" → "Asset Management" → "Platform List".

The system platform for modifying garbled assets is the new Linux-GBK.

Accessing the asset can solve the asset access garbled problem.

4.2 Modify the Linux server itself

Global modification
Global modification is valid for the entire Linux server, so that the entire system uses this encoding.
The modification method is as follows:

$ vim /etc/profile

在文件末尾加入以下配置:
export LC_ALL="zh_CN.UTF-8"  
export LANG="zh_CN.UTF-8"
退出编辑模式,保存文件。

执行以下命令,令配置有效
source /etc/profile

copy

At this point, the modification is complete, and you can execute the following command to view it.

Partial modification
Sometimes, it is just that the system is garbled when a certain user logs in to the Linux asset, so it is only necessary to adjust the coding method of this user.
Taking the mysql user as an example, the modification method is as follows:

$ vi /home/mysql/.bash_profile

在文件末尾加入以下配置:
export LC_ALL="zh_CN.UTF-8"  
export LANG="zh_CN.UTF-8"

退出编辑模式,保存文件。

执行以下命令,令配置有效
source /home/mysql/.bash_profile

copy

The modification is now complete.
Note: The ./bash_profile file is where each user modifies their own Shell information.

Guess you like

Origin blog.csdn.net/qq_43174065/article/details/128814743