Joe_Pritchard
asked on
unable to list current users logged in via SFTP client
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:
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
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
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
yeah, it's a wierd one, I've never seen it happen with any other user, plus I can't recreate it using that account myself. I'm trying to get in touch with the client to ask if he's done anything tricky on his end, but I can't imagine what it could be.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No real solution, it's a freak occurence that I've worked around.
ps -auwx | grep sftp | grep "username"
I am using redhat, but I don't know how you can have someone logged in without any processes showing.