LinuxQuestions.org
Review your favorite Linux distribution.
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 01-09-2008, 01:47 AM   #1
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 610

Rep: Reputation: 34
Find out number of users connected to my sftp server


Hi

I have a standard sftp server running that comes with Redhat AS 3, I want to find out

1.at a given time how many users are connected to the server
2.if possible what are they doing (uploading or downloading)

Regards
 
Old 01-09-2008, 03:17 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

Rep: Reputation: 79
Hi asankacgl,

I belive that "netstat" will give you the information. just check the number of IP address connected to the port of your ftp server.

Angel.
 
Old 01-09-2008, 04:40 AM   #3
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 610

Original Poster
Rep: Reputation: 34
Thanks Angel but is there a simple way of checking like w command, because this will be used by audit personal not by a linux literate
 
Old 01-09-2008, 11:39 AM   #4
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 535

Rep: Reputation: 79
Ok so try this in a bash script:

Code:
#! /bin/bash
SFTP_port=21

echo "The number of connection to the SFTP server is: " $( netstat -a |grep tcp |grep :${SFTP_port} |wc -l)
This should do the trick
 
Old 01-09-2008, 12:38 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Good advice, angel115. I only would add the -n option to the netstat command. This will force the numeric representation of adresses and ports, otherwise the default ports will have their name ("22" will be "ssh").
 
Old 01-10-2008, 11:47 PM   #6
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 610

Original Poster
Rep: Reputation: 34
Thanks guys
 
  


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 can I find connected users? adham1sa Linux - Networking 6 09-11-2009 04:44 PM
how I can find out how many users are connected/ using with my proxy . shahg_shahg Linux - Networking 3 12-10-2005 08:58 AM
find out which users are connected??? lemay_jeff Linux - Newbie 2 06-15-2004 11:14 AM
how to find the number of users mtest Programming 3 10-28-2003 03:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:47 AM.

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