On Ubuntu/Debian, you can install the
scponly shell to restrict them to scp/sftp only. Just install the package and change their shell to
sudo aptitude install scponly
sudo usermod -s /usr/bin/scponly USERNAME
The disk space problem is likely best solved with filesystem quotas. Unfortunately I have little experience with them.
If you want to get fancier (restricting filetypes and such) you'll probably need to write your own script to validate the commands being passed from the client. The simplest script would be a shell script that performs a test similar to this one:
if [[ $SSH_ORIGINAL_COMMAND = "scp -f *txt" ]]
That would allow downloading .txt files. Quick tests indicate the filename is not passed as part of the scp command when sending. So it may not be possible in that case.
The script would be set as the forced command for the user's key. (The ``command="blah"'' field in authorized_keys.) It can also be set as the "ForceCommand" option for a Match group in sshd_config, like so:
Match group scponly
Then add the users to be so restricted to the "scponly" group.
By request, here's the script I use to enforce rsync-only access:
# Verify that rsync command appears to be a legitimate rsnapshot command.
# Requires >= bash 3.x
# Ben Beuchler
# rsync needs to be operating in "server" mode.
# Match both -x and --word options
# Match legal paths
# Build the full regex
echo $SSH_ORIGINAL_COMMAND >> ssh_log
if [[ $SSH_ORIGINAL_COMMAND =~ $r ]]
echo "Invalid rsync command."
Use that script as a forced command (either by "command=" in ~/.ssh/authorized_keys or using a "Match" block in sshd_config as noted above) and it will reject everything except rsync commands. With a little tweaking it could be made to only accept specific rsync commands.