2

How can I disable some commands in SFTP for my clients, like ln & symlink?

I've checked man sftp, but didn't find what I'm searching for.

  • This doesn't make much sense. Why do you want to do this? – Michael Hampton Mar 04 '17 at 03:32
  • As Michael Hampton said, this doesn't make sense. The only thing I can think to do is disallow access to those commands with Linux ACLs from the users that log onto your server via SFTP and/or, depending if you're running SFTP in a chroot jail, the specific user that is running SFTP. – cerberus Mar 04 '17 at 04:15

2 Answers2

4

You did not specify, what SFTP server are you using. I'm assuming the OpenSSH.

The sftp-server (and the compatible internal-sftp) has the -P and -p switches to black/white list certain SFTP requests.

You can use them to disallow the symlink requests:

Subsystem sftp internal-sftp -P symlink
0

You can only pass args to the sftp command when using ForceCommand, not Subsystem. If you do what the other answer says, the -P arg will be silently ignored!

The correct way:

Subsystem sftp internal-sftp

ForceCommand internal-sftp -P symlink

(you possibly also want to put a Match block around the second line)

womble
  • 97,049
rufo
  • 31