HowTo: Linux Limit A Specific User’s Shell Account Network Bandwidth Using Bash Shell and Trickle

To limit the network bandwidth of a specific user’s shell account in Linux, you can use the trickle command. Trickle is a user-space bandwidth shaper that can be used to limit the network bandwidth of individual programs.

Here is how to limit the network bandwidth of a specific user’s shell account:

  1. Install trickle:
sudo apt-get install trickle
  1. Create a shell script with the following contents, and save it as /usr/local/bin/bandwidth_limit.sh:
#!/bin/bash

trickle -d 100 -u 50 "$@"

This script sets a download limit of 100 KB/s and an upload limit of 50 KB/s for the user’s shell account. You can adjust these limits to your liking. (Klonopin)

  1. Make the script executable:
sudo chmod +x /usr/local/bin/bandwidth_limit.sh
  1. Change the user’s shell to the script:
sudo chsh -s /usr/local/bin/bandwidth_limit.sh username

Replace username with the name of the user whose network bandwidth you want to limit.

  1. Log out and log back in as the user, or restart the user’s shell session, to apply the changes.

Now, when the user logs in to the shell, their network bandwidth will be limited to the values set in the script.

Note: This method can be applied to any user with a shell account, and can be useful for limiting the network usage of users who might use excessive amounts of bandwidth.

Leave a Comment