How do I go about doing it?
You don't. Firewalling (iptables) takes place inside the kernel, as do the port assignments it pertains to. For example, if you want to run a web server on the system using the standard HTTP port (80), then that's what you have. Other computers can connect to yours using that port. There is only one port 80. If another user wants to run a separate web server, he/she will have to use a different port. In this manner, you could apply different restrictions to the different ports using iptables.
By analogy:
I have two people in my car. I notice they are driving on the same street in the same direction together. I would like to have two steering wheels in the car so they can drive on separate streets.
Since we all understand what a car is, we all understand this is a non-sensical desire.
The same logic applies to the root filesystem. There is only one. Different users can have different restrictions placed on them with regard to accessing it. WRT to applications, you can use the per user $PATH
variable to control which ones are used by default.
As steeldriver points out, it is possible to run a completely separate operating system inside a virtual machine, on which you could have users unrelated to the ones on your "real" (aka host) OS. This option is a little like setting up a video game console in the back seat of your car so driver #2 can have somewhere different to go.
There are other mechanisms, such as chroot
, which can box a user's perspective on the system. However, the normal way to customize a user's environment is to do so by using application specific, per user configurations. For example, you can specify a different desktop environment by adding an .xinitrc
in your home directory, so that one user uses GNOME and another KDE. If that file is not present, the user uses the system default.