CentOS 7
Sponsored Link

SFTP only + Chroot
Configure SFTP only + Chroot.
Some users who are applied this settings can access only with SFTP and access to the permitted directories.
[1] For example, Set /home as the Chroot directory.
# create a group for SFTP

[[email protected] ~]#
groupadd sftp_users

# apply to a user "cent" for SFTP only

[[email protected] ~]#
usermod -G sftp_users cent

[[email protected] ~]#
vi /etc/ssh/sshd_config
# line 147: comment out and add a line like below

Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# add follows to the end

Match Group sftp_users
  X11Forwarding no
  AllowTcpForwarding no
  ChrootDirectory /home
  ForceCommand internal-sftp
[[email protected] ~]#
systemctl restart sshd

[2] Try to access with a user and make sure the settings.
[[email protected] ~]#
[email protected]'s password:
This service allows sftp connections only.
Connection to closed.
# denyed normally
[[email protected] ~]#
Connecting to
[email protected]'s password:
ls -l

drwx------    3 1000     1000         4096 Jul  9 12:06 cent
drwx------    2 1001     1001           59 Jul  8 22:06 hirokun

Remote working directory: /