I have a user who logs in via sftp but he opens a lot of sessions and keep them opened. This will make ssh and sftp very slow for all other users. I thought about using

ClientAliveInterval   number in seconds
ClientAliveCountMax number of counts

but it will affect all users and it can tricked by adding other parameters from client machine(s).

Note I am using Debian 8.3 and I am enabling server ftp service too.

My questions:

  1. Is there a way to drop the user session if there is no real action like copy, move ..etc
  2. Can I add parameters above for just one user?

The ssh daemon does not know what actions a user does. If you want to check that, you would have to either turn on detailed auditing (slow) or accounting, and analyze the logs (in either case, fairly slow).

Further reading:

| improve this answer | |
  • thanks for the info, one more question if you dont mind is there a command similar to who can list sftp users? not one of ps commands, I guess I found a way to it but my problem now is who only showing ssh users only not alone with sftp. – Ahmad Abuhasna Feb 17 '16 at 10:47
  • no - but you can pick the information out of ps, since each sftp session uses /usr/lib/openssh/sftp-server. – Thomas Dickey Feb 17 '16 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.