As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [hosts]

An /etc/ file that lists the hosts on a network (/etc/hosts ).

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

Help with error: Failed to restart hostname.service: Unit hostname.service not found

Followed a tutorial for setting my hosts and hostname file. When I go to service hostname restart I get error: Failed to restart hostname.service: Unit hostname.service not found. My hosts file is set ...
ubudoge's user avatar
1 vote
1 answer
65 views

Check a host file for modification and if missing add it

I'm using docker in which the container has its own /etc/hosts file. It gets cleared out when rebooting. I'd like to create a script to check for an entry and if missing add it. So if /etc/hosts has ...
Mark Vetter's user avatar
0 votes
0 answers
35 views

Error reading /etc/hosts using nano-strict on Ubuntu Core

I'm doing some development work with Ubuntu Core and IoT Management. Since I am used to using nano on Ubuntu Server I decided to install it and use it on Ubuntu Core with the following commands: snap ...
Kris's user avatar
  • 139
1 vote
1 answer
1k views

Editing /etc/hosts using WSL vs. using Notepad as an administrator

Why am I not able to modify my /etc/hosts file in Ubuntu through WSL? But if I try to run Notepad as an administrator and name the file as c:\Windows\System32\drivers\etc\hosts, I am able to modify ...
Ommm's user avatar
  • 51
0 votes
0 answers
141 views

Remove Immutable Flag from /etc/hosts

I am attempting to change the /etc/hosts file on a VPS with Ubuntu 20.04 LTS. I cannot open the file for editing and chmod is not able to affect the file: root@Montgomery06:~# sudo chmod +w /etc/hosts ...
Snappy's user avatar
  • 1
1 vote
1 answer
127 views

Grep doesn't return any value in the search

I am looking for a specific value while searching a text file, but with grep I am unable to pull that value. with -head 50, I can see the first 50 lines. with cat and filename, I see the output as ...
ksv001's user avatar
  • 13
1 vote
0 answers
147 views

Editing hosts file to block sites isn't working for 4chan, how do I fix it?

I have blocked quite a few sites by editing the hosts file but have just discovered that this method doesn't seem to be working for 4chan. The method I'm using is sudo -i gedit /etc/hosts and then of ...
firgnaw's user avatar
  • 11
0 votes
0 answers
237 views

Multiple hosts name possible on samba server side?

I want to use 2 hostnames to access my samba server. such as like this... I mean, On my local network, I want to access the same server (everything is similar) but with 2 different names on network. ...
armacomputer's user avatar
1 vote
0 answers
221 views

How to Set mac address as host name and hosts 127.0.1.1

I'm using Ubuntu for my OS and I'm struggling to set my host name and hosts to a mac address automatically any help on this would be great. NAME=$GATEWAY_MAC| sed s/://g hostnamectl set-hostname $NAME ...
Kasey champion's user avatar
0 votes
1 answer
51 views

How to prevent my computer from connecting to a specific site [duplicate]

I recently decided to make the switch to Ubuntu. And I had a question pertaining to site connections. Before beginning, I need to give some context. I am/was addicted to youtube. I think at my peak in ...
GoodSalt's user avatar
2 votes
1 answer
2k views

`sudo visudo /etc/hosts` gives syntax errors

Really dumb question, Ubuntu 20, and I have apache2 installed, not much else. I go sudo visudo /etc/hosts and want to add an alias "dummy.com" domain alias as a hack to point to the server ...
Conrad B's user avatar
  • 167
1 vote
1 answer
69 views

"mate-network-properties" won't honor ignored-hosts address

I want to block a social media address. When I block it via echo "127.0.0.1 facebook.com" | sudo tee -a /etc/hosts > /dev/null works. But when I use mate-network-properties gui and ...
kenn's user avatar
  • 5,024
0 votes
1 answer
75 views

Host name access not working

Ubuntu Server 20.04.3 LTS Linux 5.4.0-88-generic Hostname : plexserv All was working fine, Plex and Samba set up, could access files on the server from Windows and MacOS machine no problem. Then I ran ...
exharris's user avatar
  • 133
1 vote
1 answer
350 views

how to activate a new /etc/hosts instantly

I'm using a terminal command to replace the /etc/hosts - file. alias nonews="sudo -S chattr -i /etc/hosts < /etc/password_file && sudo -S cp /etc/hosts_all_blocked /etc/hosts < /etc/...
Thomas R's user avatar
  • 201
0 votes
1 answer
628 views

Adding block list to hosts file

Ubuntu 21.04. Linux newbie here. For a few months I’ve been thinking about setting up a pi-hole to block ads. But a few days ago I read about just adding a block list to the hosts file. I wasn’t aware ...
Advait's user avatar
  • 415
0 votes
1 answer
3k views

How do I edit hosts files? Lubuntu 20.04

Normally I get a access denied even after I change it's permission to 777. I see many solutions Use gedit, dunno how to get use or find whatever that is. Other solutions use the terminal sudo -i gedit ...
Eric Huelin's user avatar
0 votes
1 answer
1k views

hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname

Aloha, i'm on Ubuntu 18.04 and i recently executed a deadly git clean command that was meant to clean the Hard Drive Cache and that whipped out nearly every thing on my hard disc. Now i can't license ...
Blad Abir's user avatar
0 votes
1 answer
935 views

Two VirtualHost websites do not work together under Apache 2.4

I'm running Apache 2.4 under Ubuntu 18.04 I'm having this problem where all addresses I type onto the browser bar get redirected to one of the two websites I have configured (in this case, whenever I ...
Felipe's user avatar
  • 479
2 votes
1 answer
2k views

Not Found The requested URL was not found on this server

This is how my virtual hosts the-square.local.conf looks: <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port t> # the server uses to identify itself. ...
Marinario Agalliu's user avatar
1 vote
0 answers
495 views

How to resolve captchas whilst blocking google.com on Ubuntu 20.04?

Question How could one solve captchas, such as those shown by zoom when one would like to join a meeting from the browser, whilst blocking access to www.google.com (search queries) on Ubuntu 20.04? ...
a.t.'s user avatar
  • 265
0 votes
1 answer
114 views

Advance working of /etc/hosts file in ubuntu

I have a Java application which is distributed and having a network connection with a NFS share. The application is using DNS to connected to network share. We wanted to test a network connection ...
Dinushka's user avatar
0 votes
2 answers
806 views

Deny smtp connection from unknown and unverified hosts with hosts.deny

I need to reject all smtp connections whose host name is unknown or does not match its address. Have tried setting in hosts.deny: smtpd: UNKNOWN smtpd: PARANOID but Postfix logs show that they are ...
yaugenka's user avatar
  • 121
1 vote
0 answers
682 views

Nmap keeping crashing and popping up the "System Program problem detected", should I worry?

$ sudo nmap -vv -P -T1 192.168.0.1/24 Output: >Warning: The -P option is deprecated. Please use -PE >Starting Nmap 7.80 ( https://nmap.org ) at 2021-01-01 18:29 -03 >Initiating ARP Ping Scan ...
user197536's user avatar
1 vote
1 answer
571 views

How to route DNS resolver to a different DNS based on the URL hostname?

This is why I would like to do: Most hostnames -> Resolved by DNS1. Some hostnames -> Resolved by DNS2 (I don't know IP addresses just the hostname). It should look as creating a whitelist/...
denik1981's user avatar
  • 123
1 vote
0 answers
915 views

Blocking hostname and subdomains in hosts file

I have recently started using /etc/hosts to block distracting websites. For specific domains that works nicely, but is there any way to match a domain and all of its subdomains? So, this blocks ...
xeruf's user avatar
  • 382
0 votes
1 answer
1k views

Firefox uses remote name lookup before /etc/hosts

I have added the following line to my /etc/hosts file on Ubuntu: 192.168.0.104 www.tondering.dk www.xzutsfsdet.com 192.168.0.104 is an IP address on my LAN. www.tondering.dk is a server that exists ...
oz1cz's user avatar
  • 902
0 votes
1 answer
31 views

Is it possible to create a rule for etc hosts (Rule: 10.0.0.* ip. Usage: ping ip.10)?

If I have multiple hosts I want to add aliases for, e.g. 10.0.0.10 ip_10 10.0.0.11 ip_11 10.0.0.12 ip_12 Is there a way to have a group these into one line? I tried 10.0.0. ip and then tried to ping ...
CIsForCookies's user avatar
4 votes
1 answer
13k views

How to redirect a URL to another URL using /etc/hosts

I want to block some sites on my ubuntu system.So, I added some lines to the /etc/hosts, which are 127.0.1.1 www.reddit.com 127.0.1.1 www.facebook.com This now successfully blocks the ...
Heisenberg's user avatar
  • 1,546
1 vote
0 answers
85 views

WP Multi-Site Install on Ubuntu 18.04 LAMP Keeps Re-Directing URL

After a few weeks of head banging... I am very near to completing a local development environment for my WP Multi-Site Installation. The final problem that I have (wishful thinking), is that the ...
nightwatch's user avatar
0 votes
1 answer
924 views

/etc/hosts block or redirect domain

I tried blocking domains like this: 127.0.0.1 https://facebook.com 127.0.0.1 https://www.facebook.com But FB open correctly. How can I block or redirect websites on this file?
Konfus2234's user avatar
1 vote
0 answers
20 views

Unable to resolve custom hostnames in /etc/hosts [duplicate]

I'm running Apache/2.4.41 on Ubuntu 20.04. I'm trying to setup a virtual host. Neither Chrome nor Firefox are able to resolve hostnames specified in /etc/hosts file. Even before setting up the test....
Mew's user avatar
  • 11
0 votes
1 answer
1k views

To access another user from a remote desktop while admin is logged in Linux in host machine

Suppose I am logging in as a admin and I want to login as a guest user which is present in the same machine using another remote desktop using any of the services??.I don't want shell using ssh but ...
Georgely joe Santino's user avatar
1 vote
0 answers
81 views

How to get all ip from domain name?

I use getent hosts domainname.com As a result, I get only 10 ip. I know that this domain name has a lot more ip. How to display them all? This is a VPN server. I'm just trying to create allowing ...
Rollo's user avatar
  • 21
0 votes
0 answers
3k views

ssh-copy-id testnode fails with ERROR: ssh: Could not resolve hostname testnode: Temporarily failure in name resolution

I am not able to mention the SSH Generated Key to my test node. This is the output I get whenever I run the command ssh-copy-id: aibak@aibak-Inspiron-3542:/$ ssh-copy-id testnode /usr/bin/ssh-copy-...
uaibak's user avatar
  • 1
1 vote
1 answer
1k views

`hostname` result is different from "/etc/hostname" after upgrade

If I open a terminal windows in my graphical user interface, hostname command result is different from content of /etc/hostname: me@ZyXEL1:~$ hostname ZyXEL1 me@ZyXEL1:~$ cat /etc/hostname N4010 me@...
PHP Learner's user avatar
  • 2,648
1 vote
1 answer
1k views

Adding hosts to hostfile breaks DNS in 18.04 but didn't in 16.04

EDIT I managed to find out what I was missing that made it clear how to fix my problem. Turns out that between 16.04 and 18.04, Ubuntu and derivatives switched from something dnsmasq based to ...
Turnip Wizard's user avatar
4 votes
0 answers
284 views

Hosts file for snap applications

I installed spotify using snap. Now I wanted to change the hosts file to block ads. I used to change the global hosts file and it worked. But then I was installing spotify from the apt repository. I ...
Dines's user avatar
  • 53
2 votes
2 answers
3k views

virtualbox - How to make "localhost" point to the host's "localhost"?

I know I can access the host's localhost using 10.0.2.2. However, what I need is to to be able to type "localhost" in my VirtualBox Edge browser and for it to point to the localhost of my computer. I ...
Maxime Dupré's user avatar
16 votes
2 answers
8k views

/etc/hosts not working

I populated /etc/hosts with device names and IP addresses. For example: chassisOne 10.0.0.1 chassisTwo 10.0.0.2 . . . etcetera. I am able to ping the IP address of both chassisOne and ...
Dale Smith's user avatar
0 votes
1 answer
519 views

Error message while updating

I am using Kubuntu 18.04.2, I opened terminal and entered the following command to update: sudo apt update It produced the following result: [sudo] password for aayush: Hit:1 http://packages....
Aayush Kumar's user avatar
1 vote
1 answer
941 views

Does dnscrypt-proxy's configuration replace /etc/hosts?

I've recenly installed dnscrypt-proxy. The configuration file for it at /etc/dnscrypt-proxy/dnscrypt-proxy.toml has a blacklist section I'm currently using: [blacklist] ## Path to the file of ...
Xosrov's user avatar
  • 73
1 vote
0 answers
773 views

Resetting $HOST after some other command modified it

Anaconda incorrectly overwrites the $HOST variable which seems to be caused by this anaconda bug. It exports x86_64-conda_cos6-linux-gnu as the HOST. This probably occurs only when ran inside .bashrc ...
Kostas Mouratidis's user avatar
0 votes
1 answer
114 views

Blocked host not fount in /etc/hosts?

I have blocked some host on my system (e.g. facebook.com) but I can not find them in the hosts file. I assume I have blocked hosts elsewhere or with some program but I do not remember where/which. I ...
user634299's user avatar
4 votes
0 answers
270 views

How do I change hosts file only for a snap app instead of changing my system hosts file?

I see every snap app (in /snap directory) have a etc directory and some of them have a hosts file. Can I change it to prevent snap app connect to an address?
Vân Phong Nguyễn's user avatar
0 votes
1 answer
101 views

Do I need DNS Server?

I use internet (personal connection from ISP). My operating System is Ubuntu 18.4. I am aware of /etc/hosts file, but it has limitation with wild card entries (to block websites). I wanted to know if ...
Porcupine's user avatar
  • 579
0 votes
0 answers
625 views

ubuntu 18.04.2 ignoring hosts file for some domains (block ms, fb)

When configuring hosts file as such: 127.0.0.1 localhost 127.0.1.1 brad-HP-Z420-Workstation 127.0.0.1 ethical.healthcare 127.0.0.2 *.facebook.com 127.0.0.3 *.microsoft.com facebook and ...
brad sanders's user avatar
0 votes
1 answer
284 views

PC (Ubuntu 18.04.01 Server Edition) and laptop (VMware Ubuntu 18.04.01 Server Edition) linked via cable: ping works only one-way

In order to understand how to eventually make a beowulf cluster, I tried, following this reading Building a simple Beowulf cluster with Ubuntu to link my PC with Ubuntu 18.04.01 Server Edition with my ...
user2315094's user avatar
1 vote
1 answer
7k views

/etc/hosts file wiping edits after suspending or rebooting

18.04 with latest updates. I am trying to modify my /etc/hosts file so I can access my local server via its hostname. I make the change with sudo nano /etc/hosts, and it sticks fine for the ...
Hamish W's user avatar
  • 303
9 votes
2 answers
25k views

Cannot access local server with IP address while localhost and 127.0.0.1 can

I am trying to let other computers to access my local server but I tried myself locally that I cannot access it locally even myself. Several things you should know: My target Visit my server via ...
Hearen's user avatar
  • 233
0 votes
0 answers
476 views

KVM guest host communication Ubuntu virtual server

I have tried a few solutions so far but cannot get this working: I have a couple virtual servers running on my client machine. I seem to be able to connect the guests to the host or the guests to ...
cuxcrider's user avatar