Modify the Ali cloud Linux VPS host username method

  
 

When we operate SSH, we will see a prompt like [root@JaneCC ~] in the xshell tool interface, which has nothing to do with the performance and use of the machine, but it will affect our vision. Users who are pursuing perfection will definitely ask for a user name that is defined by themselves, such as our specific name nickname, or a business term for the machine.

General User Nouns We can modify the host name implementation directly in the background of the panel, or we can modify it by the command hostname, but Alibaba Cloud changes and then restores the original long and long user name. It's ugly, the following method can completely modify the method of stubborn user name.

First step, modify the host name in the hosts file
BASICvi /etc/hosts

Second step, modify the host name in the network file
BASICvi /etc/sysconfig/network

Modify the contents of HOSTNAME, this is the host name we need to modify.

Step 3, hostname command
BASIChostname JaneCC

This command sets the new hostname in both directions, then we log in again to SSH and you will see the set hostname, so even if you restart Will rebound.

Copyright © Windows knowledge All Rights Reserved