Now, when I am outside of my home network I connect to my pi by typing: Port forwarding settings can be different for different routers though, so look up directions for your router. (ApplicationTextField)_ssh (external port)_22 (Internal Port)_22 (Protocal)_Both (To IP Address)_192.168.1.# (Enabled)_checkBox I'll write out my router's port forwarding settings. Anyway, I added 'ssh' into this field and, VOILA! A working ssh connection from anywhere to my pi. I referenced these instructions for setting up the static ip, and there are many more instructional resources out there.Īlso, I set up port forward on my router for hosting a web site and I had even port forward port 22 to my pi's static IP for ssh, but I left the field blank where you specify the application you are performing the port forwarding for on the router. Set up a Dynamic DNS service and installed the software on my pi.installed and tested ssh on my home network.I was able to ssh to my pi on my network, but not from outside my home network. That’s all for this guide to fixing the error.Įven after following these steps, if you still face the issue, then do let me know in the comment section.Īs a side note, you can also use the hostenamctl command to change the hostname of your system without manually making any changes to /etc/hostname.Recently I came across the same issue. Once you’re done with the changes, you can execute the command that raised the above error. Like here, I have replaced the old hostname with the new hostname, and now let me save and close the file. If you are not finding the hostname in the following, simply paste the highlighted line into the file by replacing it with your hostname and save the file. So, simply modify the /etc/hosts with the correct hostname. Very few people know How to use cat and tac command in Linux $ cat /etc/hostname # Host addressesĪs you can see, my system hostname is trendoceans-HUB1, but here “SHEN” is still appearing, which makes a system print error about the hostname being incorrect. The output shows the main culprits lie here. Once you know the machine-name or hostname from /etc/hostname, you can proceed to /etc/hosts to find the existence of your machine name in the respective file. Like in my case, it is “trendoceans-HUB1”. Once in a while, you will encounter the above error after making changes to /etc/hostname, and fixing this issue is no more complicated than a few simple steps.įirst and foremost, find your current machine’s hostname, which you can do by running the following command: $ cat /etc/hostname Fix: Sudo Unable to Resolve Host Name or Service Not Known Error So, let’s learn how to fix the sudo unable to resolve host name or service not known in your Linux system. However, after restarting your system, when you invoke the sudo command, you encounter an error message that states “sudo: unable to resolve host your-hostname: name or service not known.” Getting error sudo unable to resolve host name or service not known after executing the sudo command, then read these steps to fix it up.Īs you know, while installing a new operating system like Debian, Ubuntu, or any other Linux distribution, installers ask you to set the hostname.Īt that time, most users kept the default hostname.īut later, you decided to change the hostname to some meaningful text, which can help you identify your system easily, and to do that, you may have followed this article or directly mentioned the new hostname in the /etc/hostname file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |