Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-19-2011, 08:33 PM   #1
LQ Newbie
Registered: Apr 2011
Posts: 6

Rep: Reputation: 1
Detect Remote Logins Within Shell Script


I've written a shell script that among other things, restarts network services. As such, I'd like to keep those who are remoting in via putty, etc. from executing the script. Is there a way to detect this and restrict running the script (by adding additional coding in the script) that disallows running it from unless you are logged in directly to the machine? It's written in bash. Thanks.
Old 04-19-2011, 09:10 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
Have a look at the third column in the output of 'w'



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 call Shell Script on a remote server with remote servers env variables need Linux - Server 1 10-14-2009 09:37 PM
shell script to view current and recent logins?? nihapiccaso Linux - Newbie 1 06-04-2009 11:35 PM
detect shell script language lorebett Programming 10 09-02-2006 12:15 PM
Detect remote or local connection from shell. unreal128 Linux - General 2 07-29-2006 01:13 PM
Shell Script to control logins NIkss Programming 9 12-17-2003 01:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:30 PM.

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