LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-04-2009, 01:59 PM   #1
Pengoo
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Rep: Reputation: 0
Question login script


Searched the net, can find the answer, must be using the incorrect key words.

/home/usernamehere/.profile

This gets exicuted when they login.

Id like to set a timer that after x minutes, it tells them
echo "Thank you - bla bla bla, this session will close in 1 minute"

then kill session after x+1 minutes

Any help would be appreciated.
 
Old 06-04-2009, 02:33 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
You want to write a script that auto logs people out at a specific point, is that what you're saying?
 
Old 06-04-2009, 04:23 PM   #3
Pengoo
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
yes, ie , its a trial account, meaning, it informs them via echo that there about to be discounected, then kicks them one minute later.

Echo i can do, the timers and kill command im unsure of.
 
Old 06-04-2009, 04:28 PM   #4
Pengoo
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
I assume i can also place here a check to see if its already logged in , ie

if trialuser connected = true
kill
end if

Something like that so only one connection is available at a time...
 
Old 06-04-2009, 05:06 PM   #5
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Code:
man write
man logout
 
Old 06-04-2009, 05:46 PM   #6
soleilarw
Member
 
Registered: Apr 2009
Posts: 107

Rep: Reputation: 19
I'm not sure if a 5-minute session really makes sense for testing. Maybe consider setting up jailroot accounts for testing with limited tools available and do not bother about logouts. Maybe rather have a script to check inactivity, if the test user didn't logout properly, but isn't using the account - only then do a logout.

Linux Archive

Last edited by soleilarw; 06-18-2009 at 05:33 AM.
 
Old 06-04-2009, 06:44 PM   #7
Pengoo
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
makes sense ... is there a way then to limit one user per account per session?

dont want 2x concurrent sessions on same username...
 
Old 06-05-2009, 05:55 AM   #8
soleilarw
Member
 
Registered: Apr 2009
Posts: 107

Rep: Reputation: 19
The 'who' command will provide a list of logged users. You will certainly need a script to sort out the list (maybe with grep) and to check for multiple logins with the same name. Put the script reference in the user account's .bashrc or .bash_profile script to do the test and immediately log out again if the account is already used.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check in a script whether the shell is login or non login? frankie_DJ Programming 7 10-21-2015 11:09 AM
Script After Login amivit Slackware 9 10-26-2007 07:05 AM
login script btaylor1988 Linux - Server 8 09-12-2007 09:22 AM
login script steve007 General 5 07-01-2005 09:49 AM
Login script unclejessie77 Programming 5 02-24-2005 01:30 PM


All times are GMT -5. The time now is 01:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration