How can I restrict certain file extensions and file upload size via SSH?
I am using Ubuntu 12.10 default installation and Open-ssh server.
OpenSSH doesn't natively have these facilities, though you might be able to partly do this with commercial products (CrushFTP, Linoma or Barracuda come to mind).
If you want to apply content-filtering to uploads you can do this with OpenSSH by allowing users to upload to an incoming spool, and periodically scanning and moving approved content to an outgoing spool, this also works for A/V scanning.
Update: since OpenSSH allows delegating the sftp server to an external process (via
It has a configurable maximum file size setting, and it supports callback functions for file transfer events, allowing you to inspect the file name (and content) — though the callbacks are only invoked after completion of the transfer.
You could trivially patch the
You can enable it globally in