Editing /etc/hosts-file

Antworten
bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Editing /etc/hosts-file

Beitrag von bobzbobz »

Hello

I am trying to create a new product-package that blocks certain websites from being displayed.
I have read that the "easiest/best" way to achieve this, is to edit the /etc/hosts-file like such:
I need to create a package that can add these lines (perhaps from a .txt-file?) and remove them again, without removing other lines in the file.
What would be the correct approach to this task? Using "loadTextFile" to read the .txt-file into separate strings and then write them somehow?
Zuletzt geändert von bobzbobz am 23 Jan 2020, 11:43, insgesamt 1-mal geändert.
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1412
Registriert: 01 Jul 2008, 12:10

Re: Editing /etc/hosts-file

Beitrag von wolfbardo »


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Re: Editing /etc/hosts-file

Beitrag von bobzbobz »

Thank you for the quick response :)

I have now created the package (might not be the prettiest code) and uploaded the scripts to the OPSI-wiki.
wiki/doku.php?id=userspace:block_websit ... hosts-file
Antworten