【问题标题】:Debian command-line cannot resolve hostDebian 命令行无法解析主机
【发布时间】:2014-06-13 01:50:08
【问题描述】:

我遇到了远程命令行无法解析本地主机名的问题。它不会显示为user@localhostuser@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/hosts

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

【问题讨论】:

    标签: linux debian hostname hosts


    【解决方案1】:

    您的/etc/hostname 非常错误。 它应该是 FQDN 的纯文本,例如 example.comlocalhost,而不是类似的 @ 副本987654324@

    您可能想使用命令hostname 来查看和设置主机名,man

    【讨论】:

    猜你喜欢
    • 2014-05-20
    • 2011-04-30
    • 2016-02-13
    • 2017-03-26
    • 2013-02-06
    • 1970-01-01
    • 2015-02-27
    • 2019-09-17
    • 1970-01-01
    相关资源
    最近更新 更多