歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Ubuntu中如何修改用戶名和主機名

Ubuntu中如何修改用戶名和主機名

日期:2017/3/3 15:56:35   编辑:關於Linux

修改方法如下:

1. 修改用戶名稱:

切換到root打開如下兩個配置文件

sudo gedit /etc/passwd

把我想改的"xxx"這個用戶名改為"way"了,保存並退出

sudo gedit /etc/shadow

同樣把"xxx"改為"way" ,保存並退出

重啟後名字就變成了way@xxx-ubuntu:

2. 現在要修改計算機名稱xxx-ubuntu為way-ubuntu

修改有兩步:

①. 修改/etc/hosts:sudo gedit /etc/hosts

127.0.0.1 localhost

192.168.76.21 way-ubuntu

# The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

~

②. 修改/etc/hostname內容為

way-ubuntu

保存,退出,重啟,就可以了。

本欄目更多精彩內容:http://www.bianceng.cn/OS/Linux/

Copyright © Linux教程網 All Rights Reserved