Questions tagged [hosts]
An /etc/ file that lists the hosts on a network (/etc/hosts ).
209 questions
0
votes
1
answer
51
views
Block specified websites Ubuntu 24.04
I am running Ubuntu 24.04.2 LTS.
I updated the /etc/hosts file and tried blocking some websites using the 127.0.0.1 websitename.com and it did not work. I even rebooted the machine and it still did ...
0
votes
0
answers
665
views
Ubuntu 24.04 has changed the way additional hostnames are treated in /etc/hosts, how can I restore the 20.04 behavior?
I have a number of local test hosts named in /etc/hosts thus:
127.0.0.1 localhost local-a local-b remote1 remote1-a local-sfbay remote2 remote2-a roger1
When I migrated to 24.04, one old, but still ...
1
vote
0
answers
30
views
Make Hosts Only Edit Via Custom (not sudo) Password - To Stop Addiction
I use Firefox extensions and modifications to the hosts file in the /etc directory to block websites like Instagram, Reddit, and YouTube. However, I sometimes bypass these self-imposed restrictions ...
0
votes
1
answer
482
views
sudo: unable to resolve host: Name or service not known
I noticed that in my team's Docker CI sudo commands, e.g. time sudo xvfb-run coverage run -m pytest test/gui, report an error such as:
sudo: unable to resolve host runner-qwqjblm--project-1351-...
0
votes
1
answer
44
views
hosts.deny file breaks when I edit it with python- why? and how do I edit the file with python without losing functionality?
I've started monitoring system logs on my ubuntu sever and noticed thousands of failed ssh attempts from ips all over the world. I wrote a simple python script to track the ips and then edit them into ...
0
votes
1
answer
153
views
Unexplained read error w/hosts.allow hostname lookup only
Yesterday I was locked out of a server with the error "kex_exchange_identification: read: Connection reset by peer" and I immediately found the cause after having connected over KVM that the ...
0
votes
0
answers
113
views
Is it possible to block ONLY the homepage of YouTube but not its videos using /etc/hosts?
Use Case: Block the homepage of YouTube (https://www.youtube.com) but not YouTube videos (https://www.youtube.com/watch?v=Y1lsbF9NWW0)
In order to block the YouTube homepage, I modified my /etc/hosts ...
0
votes
2
answers
677
views
Host and fstab file messed up after try to change swap size
I was trying to increase the swap size of my Ubuntu. I, naïve, followed the steps of this answer:
Check the swap that is in use:
sudo swapon -s
If swap partition(s) are found:
sudo swapoff -a
sudo ...
0
votes
1
answer
467
views
I am unable to access or write to etc/hosts file
I am attempting to edit theetc/hosts file. I am able to access it through the graphic file system to find that it is read only. When using sudo nano etc/hosts as many suggest, I see that the directory ...
0
votes
1
answer
45
views
Multi sites hosts on a virtualbox webserver
I have a LAMP server on Kubuntu running in virtualBox (NAT network).
I have two sites site1.conf and site2.conf too create virtualhosts
I have modify hosts to have access localy site1.local and site2....
0
votes
0
answers
172
views
How to block a specific youtube video on ubuntu?
I can already block whole websites using /etc/hosts. Right now I want to block some specific Youtube videos for all users. The exact URL blocking is not working and the URL itself is dynamic. How can ...
0
votes
0
answers
27
views
After fresh install my laptop is still hosting on my router even with wifi disabled?
I have a Dell Inspiron N5010, did a fresh install via USB erasing the disck & using automatic applied settings (Did not have wifi or bluetooth on both soft/hard).
I did this because I my laptop ...
0
votes
0
answers
279
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 ...
1
vote
1
answer
126
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 ...
1
vote
1
answer
6k
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 ...
1
vote
1
answer
341
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 ...
1
vote
0
answers
335
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 ...
0
votes
0
answers
656
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.
...
1
vote
0
answers
425
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
...
0
votes
1
answer
65
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 ...
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 ...
1
vote
1
answer
122
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 ...
0
votes
1
answer
207
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 ...
1
vote
1
answer
1k
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/...
1
vote
1
answer
1k
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 ...
0
votes
1
answer
14k
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 ...
-1
votes
1
answer
2k
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 ...
0
votes
1
answer
2k
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 ...
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. ...
1
vote
0
answers
773
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?
...
0
votes
1
answer
208
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 ...
0
votes
2
answers
2k
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 ...
1
vote
0
answers
989
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 ...
1
vote
1
answer
1k
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/...
1
vote
0
answers
1k
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 ...
0
votes
1
answer
2k
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 ...
0
votes
1
answer
89
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 ...
4
votes
1
answer
20k
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 ...
1
vote
0
answers
110
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 ...
0
votes
1
answer
1k
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?
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....
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 ...
1
vote
0
answers
100
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 ...
0
votes
0
answers
4k
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-...
1
vote
1
answer
2k
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@...
1
vote
1
answer
2k
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 ...
4
votes
0
answers
368
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 ...
2
votes
2
answers
5k
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 ...
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 ...
0
votes
1
answer
523
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....