Concurrently block a web site on some browsers but not others

0

I need the ability to block a particular web site, in this case youtube.com, on selected browsers or browser instances, but not block it on others. For example, suppose I have different browsers or browser instances open in virtual desktops 1, 2, and 3. I want to block youtube.com in Desktop 1 and Desktop 2, but I don't want to block youtube.com in Desktop 3.

I'm aware that sites can be blocked using the hosts file. Is there a way to do so differentially, as described, or another mechanism that would enable this?

My system uses Openbox on Ubuntu 16.04. I use Firefox, but could use other browsers if necessary. My system is slow and has limited resources, so VMs would not be a practical approach.

Ievgen

Posted 2019-01-09T12:47:11.807

Reputation: 93

The desktops aren't like VMs. They're like grouping your application windows on multiple virtual monitors, and you chose which one to look at. With a single physical monitor, it just hides the stuff you aren't currently working with. All of the application windows would otherwise be competing for space on one desktop. Virtual desktops don't really buy you anything over what you would do in a single desktop. You would need three instances of browsers open concurrently, and you would configure each one as desired. – fixer1234 – 2019-01-09T13:08:40.133

Can I running firefox with option - run application (for example) with hosts2? Or maybe.. I can setup to access youtube.com with different adress youtube2.com? Instead youtube.com, but block youtube.com?

I know about VMs, but I dont want use them. I have very slow PC server based on Odroid C2 – Ievgen – 2019-01-09T13:50:09.020

The question seems to focus on capitalizing on the virtual desktops to do different things with youtube. My point was that the desktops provide no benefit in that regard. So doing different things with youtube would be the same as if you weren't using virtual desktops. You would need three concurrent instances of browsers, and each one could be configured to the extent you can configure a browser to do what you want. From your comment, it sounds like maybe your question just suggested desktops as a possible mechanism, (cont'd) – fixer1234 – 2019-01-09T14:15:07.280

but it is actually asking about multiple concurrent instances of browsers, and blocking or not blocking youtube in various ones via the hosts file. The hosts file is applied at the OS-level, and all of the browsers operate in the same environment. So if the key part of your question is use of the hosts file, I think you could only do that with VMs. If the key part of your question is just differentially blocking youtube, you could probably accomplish that by means other than using the hosts file. If you can clarify the question, people will be better able to answer. – fixer1234 – 2019-01-09T14:15:13.460

I know only one way for blocking sites - hosts. But I need locally deny access to youtube.com, but also I need to access to youtube from another program. – Ievgen – 2019-01-10T14:12:56.383

The edit is a "serving suggestion". Feel free to roll it back or play with it. I tried to focus it more on what you want to accomplish than the specific method to facilitate getting a solution. – fixer1234 – 2019-01-11T03:07:34.550

Answers

0

There is no trivial way to do this because you do not control the site serving the pages. You can't do this with the hosts file as the hosts file only translates domains into IP addresses.

It could (theoretically) be done by forcing users through a proxy, and having the proxy provide different content restrictions based on the USERAGENT string. You would probably also need to deal with breaking HTTPS which would mean adding your own cert into the chain.

An alternative ight be to get an application layer firewall if you control the client.

davidgo

Posted 2019-01-09T12:47:11.807

Reputation: 49 152

Is the blocking "by browser type" actually required? If not, and if it is putting up an obstacle to the uninformed rather then "this is almost impossible to get arround", you would probably find it easier to do firewalling on the router combined with IP address allocation through DHCP - where the IP allocation drops connections in a pool which can / can not browse Youtube. – davidgo – 2019-01-11T03:38:08.617