欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centOS7修改主机名

程序员文章站 2022-03-12 21:18:28
...

阿里云ecs上centOS的名字太长了,然后看上去比较乱,于是,改一下名字:

[[email protected] root]$ hostnamectl set-hostname  centOS7
==== AUTHENTICATING FOR org.freedesktop.hostname1.set-static-hostname ===
Authentication is required to set the statically configured local host name, as well as the pretty host name.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ===
[[email protected]fz root]$ 

改完后,重新ssh登陆:

➜  htdocs ssh [email protected]
[email protected]'s password: 
Last login: Sun May  6 00:32:58 2018

Welcome to Alibaba Cloud Elastic Compute Service !

[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ 

还是新名字看着舒服。

附加:以前总认为linux上密码不出现*号是反人类设计,和thinkPHP3上的单字母函数平起平坐(虽然主流观点上有一大堆各种言之凿凿的理由)。但是,现在看上面的复制,总有一种莫名其妙的美感。