Tuesday, May 12, 2020

How To Create SFTP User without Shell Access on Ubuntu 20.04 LTS

Video Tutorial - https://youtu.be/N5j0q3A6ePg

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 This Video tutorial will help you to create SFTP only user (without ssh access) on Ubuntu systems. The user can connect the server with SFTP access only and allowed to access the specified directory.

SFTP – SSH Secure File Transfer Protocol -
SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol. It supports the full security and authentication functionality of SSH.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Os : Ubuntu 20.04 LTS (focal fossa)  ip Address - 192.168.1.20 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
sudo apt update ; sudo apt install -y build-essential net-tools curl git software-properties-common ssh
sudo adduser --shell /bin/false sftpuser            [ Username - sftpuser ]
sudo mkdir -p /var/sftp/files
sudo chown sftpuser:sftpuser /var/sftp/files
sudo chown root:root /var/sftp ; sudo chmod 755 /var/sftp
sudo nano /etc/ssh/sshd_config
Match User sftpuser
    ForceCommand internal-sftp
    PasswordAuthentication yes
    ChrootDirectory /var/sftp
    PermitTunnel no
    AllowAgentForwarding no
    AllowTcpForwarding no
    X11Forwarding no
sudo systemctl restart ssh
Test SFTP Connection - sftp://192.168.1.20
user - sftpuser   Password - yourpassword

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1 comment:

  1. hi
    I'm getting negative/failed connection after 20 seconds
    configured SFTP on Linux machine and accessing from another windows Machine(Filezilla) to connect my SFTP.

    ReplyDelete