bash scripts at user login/logout

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
abc123

bash scripts at user login/logout

Post by abc123 »

ok i want to make it so that one specific user on my computer doesn't have access to the Internet. so i thought that i could make two bash scripts , one that disables eth0 and eth1 when they login, and another one that enables eth0 and eth1 when they logout.

i made two bash scripts that look like this:

Code: Select all

#!/bin/bash
sudo ifconfig eth1 down
sudo ifconfig eth0 down
exit 0
and

Code: Select all

#!/bin/bash
sudo ifconfig eth0 up
sudo ifconfig eth1 up
exit 0
i want to know where to put those so that the 1st one runs when they login and the 2nd one runs when they logout.

Maybe I'm going about this all wrong, if there is some better way i would like to know.
i'm using linux mint 9 gnome
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Silent Warrior
Level 5
Level 5
Posts: 505
Joined: Mon Aug 24, 2009 1:10 pm
Location: Göteborg, Sverige

Re: bash scripts at user login/logout

Post by Silent Warrior »

Is it possible to disable NetworkManager (as a service) per-user? Another way might be to just modprobe -r (or is it modprobe -u?) the driver in question.

I think rc.local contain scripts run at log-in, but you wouldn't want to quote me on that.
Locked

Return to “Beginner Questions”