Seite 1 von 1

Editing /etc/hosts-file

Verfasst: 21 Jan 2020, 14:56
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?

Re: Editing /etc/hosts-file

Verfasst: 22 Jan 2020, 08:35
von wolfbardo

Re: Editing /etc/hosts-file

Verfasst: 23 Jan 2020, 10:55
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