the users from different portals are able to acess any portals with their credentials
Example User from portal 1 can access portal 1 and 2 and vice versa.
I believe you are referring to the MSP configuration. In MSP we allow the creation of multiple user portals, however, for Agents, it would be only one helpdesk hence the users can log in to any of those portals. The reason behind this is that as an MSP you can support different companies and each portal will have its own URL and users wouldn't be aware of the portal URL for other companies.
If you need to restrict this, I can suggest a workaround, where you can create a workflow to look for properties matching from Email domain and Company, for Ticket created Event and perform an action to delete the Ticket and send Email to the user to raise it from their respective Enduser Portal.
Hope this helps!