linux修改主机名

将hostname修改为新主机名

[root@demo ~]# vim /etc/sysconfig/network


NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=demo

编辑hosts添加demo

[root@demo ~]# vim /etc/hosts


# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1               demo localhost.localdomain localhost

::1              demo localhost6.localdomain6 localhost6


执行hostname更改显示主机名

[root@demo ~]# hostname demo_test

[root@demo ~]#

重新登录下

40># ssh demo

Last login: Thu Mar  6 11:31:39 2014 from 192.168.1.200

[root@demo_test ~]#


你可能感兴趣的:(linux,主机名)