sudo 出現unable to resolve host 解決方法
sudo 出現unable to resolve host 解決方法
Ubuntu環境, 假設這臺機器名字叫abc(機器的hostname), 每次執行sudo 就出現這個警告訊息:
sudo: unable to resolve host abc
雖然sudo 還是可以正常執行, 但是警告訊息每次都出來,而這只是機器在反解上的問題, 所以就直接從/etc/hosts 設定, 讓abc(hostname) 可以解回127.0.0.1 的IP 即可.
/etc/hosts 原始內容
127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback 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 後面加上主機名稱(hostname) 即可, /etc/hosts 內容修改成如下:
127.0.0.1 localhost abc #要保證這個名字與 /etc/hostname中的主機名一致才有效
或改成下面這兩行
127.0.0.1 localhost
127.0.0.1 abc
這樣設完後, 使用sudo 就不會再有那個提示資訊了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2144/viewspace-2803888/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sudo時出現unable to resolve host 的解決方法
- Android Studio 出現“Cannot resolve symbol” 解決辦法AndroidSymbol
- 記錄:yum Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error解決CloudError
- Host 'xxx' is not allowed to connect to this MySQL server 解決方法MySqlServer
- Linux:mount命令出現Host is down如何解決Linux
- Mac SSH 連線出現 Host key verification failed. 錯誤解決MacAI
- eslint-plugin-import Unable to resolve path to moduleEsLintPluginImport
- Mysql host is blocked because of many connection errors;unblock解決方法MySqlBloCError
- sublime出現 unable download.......
- ArchLinux出現ACPI ERROR的解決方法LinuxError
- Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: Host is unreachable(Host unreachable)AIbootIndexServer
- AndroidStudio升級報錯Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve cAndroidAPPCompile
- 使用 sudo 命令出現錯誤
- nginx出現403錯誤的解決方法Nginx
- Mysql 錯誤日誌出現大量[Warning] Aborted connection to db user host的解決思路MySql
- sudo rosdep init and rosdep update Error 手動新增+修改域名解決方法ROSError
- mac ping:can not resolve www.baidu.com:Unknown hostMacAI
- RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)RPCAPPAI
- 關於對連線資料庫時出現1130-host “**” is not allowed to connect to this MySql/mariadb server 的錯誤解決方法資料庫MySqlServer
- 執行Tensorboard出現kernel is dead的解決方法ORB
- sudo rosdep init 和 rosdep update 報錯的解決方法(簡單有效!)ROS
- 解決MySql報錯:1130 - Host ‘xxx‘ is not allowed to connect to this MySQL server的方法MySqlServer
- c# Api 錯誤 Unable to resolve service for type while attempting to activate C#APIWhile
- CentOS 使用 sudo 提示使用者不在sudoers檔案中的解決方法CentOS
- Centos 6 DNS 配置 解決 Unknown hostCentOSDNS
- Unable to negotiate with xx.xxx.xxxx port 22: no matching host key type found. Their offer: ssh-rsa(解決的兩種方式)Go
- 關於Failed to resolve的問題解決AI
- 完美解決xhost +報錯: unable to open display
- win10 defender出現小叉怎麼解決_win10系統defender出現紅叉解決方法Win10
- Python: 安裝 sklearn 包出現錯誤的解決方法Python
- sudo apt update時報錯 E: Unable to lock directory /var/lib/apt/lists/APT
- ROS初始化時候sudo rosdep init rosdep update出現的各種問題親測成功的解決辦法(2020.12.29已解決!)ROS
- ssh連線遠端伺服器出現Host key verification failed. lost connection問題的解決伺服器AI
- Promise.resolve() 方法Promise
- git pull報“unable to update local ref”解決方案Git
- 解決Ubuntu報錯 E: Unable to locate package yumUbuntuPackage
- Unable to load native-hadoop library for your platform解決HadoopPlatform
- windows10系統出現橙色螢幕的解決方法Windows