troubleshooting Question

unable to list current users logged in via SFTP client

Avatar of Joe_Pritchard
Joe_PritchardFlag for United Kingdom of Great Britain and Northern Ireland asked on
Shell ScriptingSSH / Telnet SoftwareLinux Networking
4 Comments1 Solution718 ViewsLast Modified:
HI

I have an SFTP server running on a Debian box, used for clients to upload data and other files to us. I've got a script running which picks up those files and delivers them to a windows server share for the office staff to pick up. My problem is this:

I'd like to add a little routine in the script to check whether the client is currently logged in (so potentially in the process of uploading files) before moving said files away and risking grabbing one that hasn't been completely transfered. I tried doing it with the following lines in my script:

 
logontest=$(ps auwx | grep -v grep | grep "username" | wc -l)

if [ $logontest -gt 0 ]; then

exit 0

Open in new window


which would work in theory, but when this particular client connects, for some reason I don't get him listed in the output from ps. I see his login in auth.log, but he doesn't spawn a "username"@notty process or anything. Now I've connected as this user (using filezilla from another machine) and checked that I definitely do show up in ps, so it may be something peculiar about the software they're using (SecureCRT form a windows box AFAIK)

Just wondering if anyone can suggest a way to resolve this, or another way to check for a current connection from this user (using his IP or something?)

Cheers
ASKER CERTIFIED SOLUTION
Joe_Pritchard

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros