I bought one at Alibaba cloud Linux The server , But root The user name turns out to be a product ID, It's not good to use .
How to change the user name , Here are three simple steps .
One 、 With root The user login , Or log in and switch to root user 、 Input... At the terminal ： hostname The current host name is displayed .
Input vi /etc/sysconfig/network, And then HOSTNAME= Change the following value to the host name you want to set .
Two 、 change /etc Under the hosts file , Enter at the prompt vi /etc/hosts, And then localhost.localdomain( It could be something else , Please find the corresponding position according to the picture , Here for me chenhaoxiang) Change to the host name you want to set .
3、 ... and 、
Input reboot command , Restart the server .
Log in after reboot , Input again hostname View host name ！ To sum up, the core command above is ：
vi /etc/sysconfig/network vi /etc/hosts reboot
This article is written by [ Familiar with memory ] To write , All rights reserved . Welcome to reprint , Sharing is the source of progress .
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .