Bug 1979 - Enhancement patch: Restrict sftp-server to basic commands, by user or group
Summary: Enhancement patch: Restrict sftp-server to basic commands, by user or group
Status: CLOSED WONTFIX
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp-server (show other bugs)
Version: 5.9p1
Hardware: All All
: P2 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-13 06:39 AEDT by Jeremy Monin
Modified: 2021-04-23 14:53 AEST (History)
3 users (show)

See Also:


Attachments
Patch versus 5.9p1 (9.64 KB, patch)
2012-02-13 06:39 AEDT, Jeremy Monin
no flags Details | Diff
Patch versus 5.9 (8.34 KB, patch)
2012-02-13 06:40 AEDT, Jeremy Monin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Monin 2012-02-13 06:39:04 AEDT
Created attachment 2128 [details]
Patch versus 5.9p1

This patch adds the ability to restrict an sftp-server user to just basic commands such as get, put, readdir, and readlink, and prohibit mkdir, rmdir, rename, symlink, setstat and their equivalents.

It comes with an sshd_config option (RestrictSFtpSysToBasics) which can be global or in a Match block.

I've found it helpful, and that request occasionally comes up on the openssh-unix-dev list.

Please give feedback and consider it for inclusion.  Patches are attached against both 5.9p1 and openbsd's 5.9.

A more advanced enhancement might let the server admin specify which commands to permit/deny; I think this is a good start.
Comment 1 Jeremy Monin 2012-02-13 06:40:01 AEDT
Created attachment 2129 [details]
Patch versus 5.9
Comment 2 blakedaddy 2012-06-18 17:28:02 AEST
hi jeremy, i just would like to ask on how to apply this patch?(sorry just a noob in linux)
Comment 3 Damien Miller 2017-04-28 13:41:24 AEST
OpenSSH 6.5 added a more general request white/blacklisting feature. See the -p/-P flags to sftp-server. Although the Subsystem option isn't currently supported by sshd_config's Match (see bug #1975), it's possible to apply these to sftp-only accounts using ForceCommand
Comment 4 Damien Miller 2021-04-23 14:53:09 AEST
closing resolved bugs as of 8.6p1 release