VMware Images:
|
Chrooted SFTP With MySecureShell On Debian Etch
Chrooted SFTP With MySecureShell On Debian EtchVersion 1.0 This tutorial shows how to install MySecureShell on a Debian Etch system. MySecureShell is an SFTP server that is based on OpenSSH and can be configured in many ways, e.g. it has support for chrooting users into their homedirs or for limiting upload-/download bandwidths. MySecureShell makes SFTP available for users that do not have shell access so that these users do not have to use the insecure FTP protocol anymore. This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!
1 Preliminary NoteI have tested this on a Debian Etch server with the IP address 192.168.0.100 and the existing user ashley. I will create a second user felix and show how both users can use SFTP with MySecureShell.
2 Installing MySecureShellMySecureShell has a few requirements, so we install these first: apt-get install libssl0.9.7 ssh openssh-server Afterwards, we download and install MySecureShell as follows: cd /tmp (Make sure you download the latest version from SourceForge.) That's it already, MySecureShell is now installed and running.
3 Preparing Users For MySecureShellBefore users can use SFTP with MySecureShell, we must change their shell to /bin/MySecureShell. For existing users (e.g. ashley), we can do it like this: usermod -s /bin/MySecureShell ashley In order to create a new user with the /bin/MySecureShell shell (e.g. felix), use a command like this: useradd -m -s /bin/MySecureShell felix Specify a password for the new user like this: passwd felix There's another way of creating MySecureShell users using the utilities that come with MySecureShell. I will describe these tools later on. Now you can open an SFTP client (like WinSCP or Filezilla for Windows, gFTP for Linux, Cyberduck for MacOS; a list of clients is available here: http://mysecureshell.sourceforge.net/fr/clients.html) and connect to the server. I'm using WinSCP here. Fill in the hostname, username, and password; the Port number is 22 (as with SSH); as Protocol you can either select SFTP or SFTP (allow SCP fallback). Then click on the Login button:
Afterwards, you should find yourself in your home directory. Try to go up one directory, and you should be denied permission which means you are chrooted to your home directory:
4 Configuring MySecureShellMySecureShell is working well in its default configuration, however, you might want to take a look at the configuration to change a few things. The configuration is in the file /etc/ssh/sftp_config which is very well commented so I don't have to explain that here. You can specify upload- and download bandwidths, chroot users, the max. amount of connections, etc., and you can do all this globally or for certain user group or based on the clients' IP addresses, etc. MySecureShell is very flexible. You can find out more about possible configurations here: http://mysecureshell.sourceforge.net/fr/confman.html Right now, I just want to turn off the download bandwidth limit which is in MySecureShell's configuration by default. Therefore I set GlobalDownload and Download to 0: vi /etc/ssh/sftp_config
After our changes, we must restart MySecureShell: /etc/init.d/mysecureshell restart
5 MySecureShell UtilitiesMySecureShell comes with a few utilities that ease the management and control of SFTP accounts and MySecureShell itself. sftp-who shows the SFTP users that are currently connected: server1:~# sftp-who With sftp-kill you can disconnect currently connected SFTP users from the server: sftp-kill felix server1:~# sftp-kill felix The command sftp-state shows the state of the MySecureShell server: sftp-state server1:~# sftp-state The command sftp-verif checks the existance and the permissions of the various MySecureShell files. You should run it once to fix permissions: sftp-verif server1:~# sftp-verif sftp-user list shows all SFTP-enabled user accounts: server1:~# sftp-user list With sftp-user delete you can delete an SFTP user account: sftp-user delete felix And with sftp-user create you can create a new SFTP user account (including password): sftp-user create felix server1:~# sftp-user create felix
6 Links
|





Recent comments
1 day 2 hours ago
1 day 7 hours ago
1 day 9 hours ago
1 day 10 hours ago
1 day 11 hours ago
1 day 16 hours ago
1 day 17 hours ago
1 day 19 hours ago
2 days 8 hours ago
2 days 10 hours ago