O'Reilly logo

Mastering Bash by Giorgio Zarrelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Restricted sftp sessions with OpenSSH

Using OpenSSH, everything can be easily done with five 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-onlyChrootDirectory /opt/jails/%u/exchangeX11Forwarding noAllowTcpForwarding noForceCommand internal-sftp

We should already know what these directives are, but let's recall what we wrote in Chapter 12, Remote Connections over SSHabout remote connections over ssh:

  • Match: With this directive, we can use conditional statements so that if they are satisfied the following configuration lines, we will override the ones in the main configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required