我的远程命令行无法解决本地主机名的问题。它不显示为user@localhost、user@ip或任何变体,而是显示为user@(none)
Using username "rogue".
rogue@<my-ip>'s password:
Linux (none) 3.13.7-x86_64-linode38 #1 SMP Tue Mar 25 12:59:48 EDT 2014 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Apr 27 15:34:56 2014 from ---
rogue@(none):~$任何程序命令都会导致此警告消息:
rogue@(none):~$ sudo service nginx start
sudo: unable to resolve host (none)
[sudo] password for rogue:看着我的主机和主机名文件,我没有看到任何异常的东西:
/etc/主机名
127.0.0.1 localhost
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters/etc/主机
127.0.0.1 localhost
127.0.1.1 debian
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters我的网络配置可能有什么问题?如果可能的话,我希望它是user@my.domain,但我需要localhost仍然正确地路由到127.0.0.1
发布于 2014-04-27 15:55:50
你的/etc/hostname是非常错误的。它应该是FQDN的纯文本,如example.com或localhost,而不是/etc/hosts的类似副本。
您可能希望使用命令hostname查看和设置主机名,man it
发布于 2022-09-24 08:27:41
这些命令呢?
hostname here.yourhost.name
sudo sed -i "s|localhost|localhost $(hostname)|g" /etc/hosts在/etc/host中在其他本地主机名旁边添加主机名
https://stackoverflow.com/questions/23325451
复制相似问题