Restricted sftp sessions with OpenSSH
Using OpenSSH, everything can be easily done with configuration lines and a few commands; let's see how. We are on the remote server.
First, let's open the OpenSSH file, which is usually found in/etc/ssh/sshd_config
and add these few lines:
Match group sftp-only ChrootDirectory /opt/jails/%u/exchange X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp
We should already know what these directives are, but let's recall what we wrote in Chapter 12, Remote Connections over SSH, about remote connections over ssh:
Match
: With this directive, we can use statements so that if they are satisfied the following configuration lines, we will override the ones in the main configuration block. If a keyword/configuration block appears in more than one match clause, only the first instance is taken in to account. As matching criteria, we can use the following directives: user, group, host, local address, l local port, address, or all for all of them. We can...