Link to home
Create AccountLog in
Avatar of goffer
goffer

asked on

Script help. Is it possible to login as a user from a script?

I've got a script that runs when a user logs in (Login=modem, which executes script modem which restarts PPP), is it possible in that script after it restarts the PPP to actually login as another user?  Basically, the user has to log out and log back in as 'modem' and then log back into their account, I'd like for them to only have to log out of their account and log in as modem which will restart the modem and log them back in to their own account.
Avatar of goffer
goffer

ASKER

Also, is there a way in a script to run certain commands as root, but run other commands without root permissions.  I've got some other scripts and programs that root can't run (part of a POS), but I need root permissions to restart the PPP.  
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of goffer

ASKER

Do I need to add both the user ALL=/path/to/modem-script AND user ALL=(modem) /path/to/modem-script?  Or is the second if I only want user modem to be able to use sudo /path/to/modem-script?
You have one or the other.

If the modem-script needs to run a a non-root user, say 'modem', then use the second configuration.
Avatar of goffer

ASKER

Works great, thank you.