A bash script that automates the process of logging into KIET's college and hostel wifi. It securely stores credentials and can be configured to run automatically at system startup.
- One-time credential setup and secure storage
- Automatic login on system startup
- Proper error handling and exit codes
- bash shell
- curl
- wget
- systemd (optional, for service installation)
- Download the script:
sudo wget -O /usr/local/bin/wifi_login.sh https://raw.githubusercontent.com/VanshSahay/kietwifi/main/wifi_login.sh
- Make the script executable:
sudo chmod +x /usr/local/bin/wifi_login.sh
On first run, the script will prompt for:
- Username
- Password
These credentials are stored securely in ~/.wifi_credentials
with restricted permissions (600).
/usr/local/bin/wifi_login.sh
- Create a systemd service file:
sudo nano /etc/systemd/system/wifi-login.service
- Add the following content:
[Unit]
Description=Automatic WiFi Login Service
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/wifi_login.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl enable wifi-login.service
sudo systemctl start wifi-login.service
Login attempts are logged to /var/log/wifi_login.log
with timestamps.
To view logs:
tail -f /var/log/wifi_login.log
-
Login Failures
- Check if credentials are correct
- Verify network connectivity
- Review logs in
/var/log/wifi_login.log
-
Script Not Running at Startup
- Check systemd service status:
sudo systemctl status wifi-login.service
- Check systemd service status:
-
Credential Reset
- Delete the credentials file and run the script again:
rm ~/.wifi_credentials /usr/local/bin/wifi_login.sh
- Delete the credentials file and run the script again:
Feel free to submit issues and enhancement requests!