Member-only story

SFTP MySecureShell

Eric Fossas
2 min readApr 17, 2018

SFTP (Secure File Transfer Protocol) is typically implemented over SSH, port 22. This tool, MySecureShell, makes setting that up really easy. This tutorial will go over its installation and the basic configuration I use with it.

Source: dilbert.com

What This Tutorial Covers

  1. SFTP
  2. MySecureShell

What You Need For This Tutorial

Ubuntu

Install MySecureShell

Installing is as simple as running a single apt-get command.

apt-get install -y mysecureshell

Configuring MySecureShell

All configuration is done in a single file: /etc/ssh/sftp_config. The file explains all the configuration options you can use.

The one thing I typically change is the directory users see when they use SFTP. I change that directory from /home/$USER to $HOME. That way, I can set a user's home to something outside the home directory. The following sed command makes that change automatically and then reloads the sshd daemon so the change takes effect.

sed -i 's@/home/\$USER@$HOME@g' /etc/ssh/sftp_config
service sshd reload

Creating Users

In order to enable a user to use SFTP, you just have to set their default shell to mysecureshell. So create users using the following commands.

useradd -s /usr/bin/mysecureshell -d HOME-DIRECTORY -g GROUP USER
password USER

Final Checks

You can view which users have their shell set to mysecureshell using this command:

sftp-user list

Make sure your server allows ssh logins with password by setting the PasswordAuthentication option to yes in the file…

--

--

No responses yet

Write a response