Ubuntu / Debian: sudo 出现 unable to resolve host 错误解决办法
在linux环境下,如果这台机子的名字是dev,每次执行sudo的时候总是出现:
sudo: unable to resolve host dev
虽然命令可以正常执行,但是老是提示这个信息还是有点烦人,而这只是机器在反解上的问题,所以就直接在从/etc/hosts设定,让系统能够从dev转换成127.0.0.1的ip
/etc/hosts 的原来内容:
$ cat /etc/hosts # 原始 /etc/hosts 設定檔內容
127.0.0.1 localhost
# 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
解决办法:
內容修改成如下:
127.0.0.1 localhost dev
# 或 改成下面這兩行
#127.0.0.1 localhost
#127.0.0.1 dev# 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
这样设置完成后,在执行sudo就不会有错误信息了。
转载于:https://www.cnblogs.com/rui1988/archive/2011/07/23/2114936.html
https://blog.csdn.net/diaoxianguan3934/article/details/101746430?spm=1001.2101.3001.6650.13&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-13-101746430-blog-80152730.pc_relevant_3mothn_strategy_recovery&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-13-101746430-blog-80152730.pc_relevant_3mothn_strategy_recovery&utm_relevant_index=14