Ubuntu:Resolve Sudo Name Resolution
- Check in your hostname by running the command "hostname" on your terminal. The result will be blank as there is no hostname assigned.
- Edit the
/etc/hostnamefile in which the hostname is stored in your system. Provide any hostname of your choice. As an example, I have assigned the hostname asinspiron-3558. You can use the following command to edit the file.
nano /etc/hostname
Note: You will need root permission to edit the file
- Once you have saved the file with your new hostname, run the command "hostname" to confirm. The new hostname should be displayed on the screen.
- Check the
/etc/hostsfile and edit the hostname same as in/etc/hostname. Thehostsfile maps the hostname to IP addresses. Hence, it is very important that you edit the hostname in the file. Please edit the hostname mapped with the IP address
127.0.1.1
- Any changes made in the files do not take effect until the system is rebooted. So, please reboot the system for the changes to take effect.
- After rebooting check the
sudocommand to ensure it is working properly.