To limit the network bandwidth of a specific user's shell account on a Linux system, you can use the trickle
utility. Trickle
is a simple bandwidth shaper that can be used to limit the network bandwidth of specific programs.
Here's how you can use trickle
to limit the network bandwidth of a specific user's shell account:
trickle
:sudo apt-get install trickle
.bashrc
file for the user whose network bandwidth you want to limit:nano ~/.bashrc
.bashrc
file, add the following line to limit the user's network bandwidth to a specific rate:alias trickle='trickle -d <rate>'
Replace <rate>
with the desired rate in kilobits per second (kbps). For example, to limit the user's network bandwidth to 128 kbps, you would use the following line:
alias trickle='trickle -d 128'
Save the changes to the .bashrc
file and exit.
Log out and log back in for the changes to take effect.
Now, when the user runs a command, it will be limited to the specified network bandwidth rate. For example, to limit the wget
command to 128 kbps, the user can use the following command:
trickle wget http://example.com/file.zip
Note that this method only works for programs that are run from the command line. It will not work for programs that use a GUI or programs that run in the background.