
This tutorial takes some time to write, edit, and update. If it has benefited you, please either take the time to email me or make a small donation. I am working on writing more Linux related tutorials.
This tutorial is a follow-up to the version 5 update of OpenSSH. In version 5, jailing is now natively supported.
NOTE: This tutorial is for attempting to jail users to their home directory and allowing them ONLY sftp access.
NOTE: This works and has been tested on centos 4.4 and 5.0
This will majorly increase security for a multi-user server. The main things it does are:
Lock users to their home directory
--This blocks their eyes from the rest of your system and from files like: system binaries, other users' files, backups, configuration files
Disable regular ssh access
--Many users just having a web site won't need an actual command interface. Its just one more thing to be hacked.
FTP already does this!!! right?
Yes, but your forgetting one thing... this is SFTP!!! It's encrypted and so it is much harder for hackers to sniff packets. Also, the user management is at
the system level, so your server tells users what they can and can't do. If your FTPd runs as root or with a high permissions level and a ftp user hacks it, it
means they have root or at least high permissions over the ENTIRE server? Not anymore.
This tutorial uses the /opt directory to install the necessary dependences. If you wish to install them anywhere else or do not have an opt directory on your server you may do so, but make sure
to change all the paths in the code below. All commands must be run as root
NOTE: The jailing setup for OpenSSH ver5 is much cleaner and uses less hacks then ver4. If you need to jail users, make sure to update to version 5.
If you are looking for the tutorial for version 4, click here.
Another NOTE: This setup is meant for installing on a fresh server. If you already have configuration files for the programs we will be installing
(zlib,openssl, and openssh), they will not be overwritten, but you will have to copy them from their old paths to the paths you install with here (recommended: /opt/...).
NOTICE: Yum will not update these programs anymore (zlib,openssl,openssh). When a new version comes out, you will have to make your own install from a tarball again. Just follow the same directions.
This tutorial takes some time to write, edit, and update. If it has benefited you, please either take the time to email me or make a small donation. I am working on writing more Linux related tutorials.