LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 06-23-2005, 10:50 AM   #1
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Rep: Reputation: 15
Question Automaticly run script when user logs in?


What I have is a non GUI environment. I have written a menu script for running simple diagnostics on my server(i.e. Ping, TraceRoute, IFConfig, NetConfig). What I am trying to create is a user that when they log in it will automatically run this menu script and if they try to break it(Ctrl+C) it will automatically log them out of the system. I have other scripts and files on this server that I do not want them to be able to get into. I have seen similar post but not exactly what I am looking for ... Please help a newb out

So here are my questions?:

1) How do I make the Script auto run?
(someone suggested pointing that users shell to the script instead of /bin/bash... but then they can't do anything... did I misunderstand them?)

2) How do I make it log them out if they try to break the script?

3) How do I lock them out of the rest of the system, but still allow them to run the commands above including manually changing the IP address of the server if necessary?


I know this is alot, but any help would be great... Thanks in advance!!
 
Old 06-23-2005, 02:34 PM   #2
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Re: Automaticly run script when user logs in?

Quote:
Originally posted by bigdog0007
What I have is a non GUI environment. I have written a menu script for running simple diagnostics on my server(i.e. Ping, TraceRoute, IFConfig, NetConfig). What I am trying to create is a user that when they log in it will automatically run this menu script and if they try to break it(Ctrl+C) it will automatically log them out of the system. I have other scripts and files on this server that I do not want them to be able to get into. I have seen similar post but not exactly what I am looking for ... Please help a newb out

So here are my questions?:

1) How do I make the Script auto run?
(someone suggested pointing that users shell to the script instead of /bin/bash... but then they can't do anything... did I misunderstand them?)

Answer: I added ./{filename} to the .bash_profile ... and that seemed to work for me.

2) How do I make it log them out if they try to break the script?

3) How do I lock them out of the rest of the system, but still allow them to run the commands above including manually changing the IP address of the server if necessary?


I know this is alot, but any help would be great... Thanks in advance!!
Now if I can find the answers to the other 2... ...Thanks for any responces
 
Old 06-23-2005, 02:56 PM   #3
afaiq
Member
 
Registered: Jul 2003
Location: Bay Area, CA
Distribution: SuSE 10.2
Posts: 33

Rep: Reputation: 15
Answer 1
every user has a .bashrc file in their home directory. Put your script in this file and it will get executed every time the user logs in. Note of caution - a user can edit this file and remove your script from it, if they they are linux literate...
 
Old 06-23-2005, 03:14 PM   #4
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for the warning afaiq

OK... here is what I did to solve all my problems.... I think.

I changed the users Login Shell to point to the script... not sure why this didn't work b4 but now it is....by doing that if the user tries to [BREAK] the script ( Ctrl + C , Ctrl + Z) it either locks the session or does nothing at all...and if they use the "Exit" option from the menu it logs them out.

Is security an issue anymore ... Is there anyway they can get past this? (Yes I know security is always an issue... You know what I mean )
 
  


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
I want to automatically run a program when a user logs on their account bad_andy Linux - Newbie 7 02-01-2005 08:55 PM
run program after user logs in kinasz Linux - General 2 09-22-2004 03:47 AM
how do I make sure that the user that is going to run the script is a root user??? nikold01 Linux - General 3 09-10-2004 07:54 AM
how can i run a shell scripts (or a number of commands )when a user logs in to a linu rddreamz Programming 4 05-20-2004 03:08 PM
Getting vncserver to run automatically when user logs in indespair Linux - Networking 2 10-26-2003 02:37 AM


All times are GMT -5. The time now is 07:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration