Configuring User Accounts and Wi-Fi on Ubuntu 24.04 Computers Lab
In this article, we will guide you through the process of configuring user accounts and Wi-Fi on Ubuntu 24.04 computers in a lab environment. The goal is to allow users to connect to the Wi-Fi network while preventing them from accessing nearby networks.
Prerequisites
- A lab of computers running Ubuntu 24.04
- A Wi-Fi network for users to connect to
Configuring User Accounts
To create a new user account, open the terminal and run the following command:
sudo adduser Replace
sudo usermod -aG sudo Configuring Wi-Fi
To configure Wi-Fi, you will need to edit the network interfaces file:
sudo nano /etc/network/interfacesAdd the following lines to the file, replacing
auto wlan0
iface wlan0 inet dhcp
wpa-ssid
wpa-psk Save and close the file. Then, restart the networking service:
sudo systemctl restart networkingPreventing Access to Nearby Networks
To prevent users from accessing nearby networks, you can edit the iptables configuration:
sudo nano /etc/iptables/rules.v4Add the following lines to the file:
# Allow loopback traffic
-A INPUT -i lo -j ACCEPT
# Allow established and related traffic
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow SSH traffic
-A INPUT -p tcp --dport 22 -j ACCEPT
# Allow DHCP traffic
-A INPUT -p udp --dport 67:68 -j ACCEPT
# Allow DNS traffic
-A INPUT -p udp --dport 53 -j ACCEPT
# Drop all other traffic
-A INPUT -j DROPSave and close the file. Then, save the iptables configuration:
sudo /sbin/iptables-save > /etc/iptables/rules.v4Finally, set the iptables configuration to load at boot:
sudo update-rc.d iptables defaults- Create user accounts with the
addusercommand - Grant sudo privileges by adding users to the sudo group
- Configure Wi-Fi by editing the network interfaces file
- Prevent access to nearby networks by editing the iptables configuration