Guide – How To Start – SFTP – FTP OpenSSH Server on Ubuntu 20.04 LTS on Amazon

SFTP – FTP OpenSSH Server on Ubuntu 20.04 LTS is the best solution to transfer files and data securely over encrypted network layers (using SSH2 protocol).

This is a quick deployment and ready-to-run image.
Simple and rapid installation. Easy to maintain.

The guide on how to connect to Secure FTP Server on Ubuntu 20.04

To connect to the VM, you should generate a “Private Key” in advance. This can be done using the following instruction (by choosing the “file format:” option “.ppk” in point 3).

Guide – How To – Create and use Key Pair to connect to a VM

  1. Go to the SSH section in the left panel and then to Auth.
  1. In the “Auth” section, click “Browse” and specify the path to the .ppk file you received earlier.
  2. Go to the home page of “Session”, enter the IP address of the VM and click “Open”.
  1. In the opened console you will need to enter the login ubuntu.

The creation of the user:
sudo addsftpuser 

Attention: The password has to be maximum 8 characters. If you enter a password with more than 8 characters, it will be shortened. While entering a password in the ftp client, only the first 8 characters will be taken.

Then you need to copy the key. Enter the next command for that:
> sudo cat /sftp/privatekeys/username_key.pem
Instead of “username” insert the name of the created user.

Copy the key and save in any text editor with .pem extension.

The examples of the basic ftp user management commands that can be entered after connecting in the PuTTY client: 

The changing of the password for an existing user:
sudo passwd username

The deletion of user:
sudo delsftpuser

The blocking of user account: (works only for password login)
sudo usermod -L username

The unblocking of user account: (works only for password login)
sudo usermod -U username

You can find a directory with users along the path /sftp/data/home/

The ftp server itself is protected and ssh access and shell access are prohibited for ftp users, but allowed for the superuser.

  1. To connect to ftp, it is recommended to use the “FileZilla Client” application(you can download it from the link: https://filezilla-project.org/download.php?platform=win64). When launched, the application looks like this:

2. Go to Edit – Settings

3. Go to sftp, click add key file, select file which you have saved before with .pem extension and click Ok.

4.

  1. In the “Host” field enter : sftp://ipvm , where ipvm is the address of your machine in the personal account in AWS.
    In the “Username” field enter the user’s login of the virtual machine.
    Field “Password” leave blank.
    When the data is entered click on “Quickconnect”.

You can disable key login yourself and then you will need a password, not the key.

For that, enter the next command:
> sudo nano /etc/ssh/sshd_config

Go to the very end of the file and change in the section Match Group sftpusers parameters:
PubkeyAuthentication yes
PasswordAuthentication no
AuthenticationMethods publickey

For the next:
PubkeyAuthentication no
PasswordAuthentication yes
AuthenticationMethods password

After making the changes, you need to restart the ssh server with the command:
> sudo systemctl restart sshd

Also you will need to delete the key in the Filezilla client and enter the user’s password in the “Password” field.

Website Built with WordPress.com.

Up ↑

%d bloggers like this: