How to setup Secure FTP on Ubuntu 21.04
To Setup Secure ftp on Ubuntu 21.04
Introduction:
A secure file transfer protocol that runs on SSH, SFTP is much more secure than FTP for encrypting data on transfer while ftp transfers data in cleartext.
Prerequisite:
Openssh-server
Step 1: Check the OS version by using the following command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Step 2: Check the availability of prerequisite package
root@linuxhelp:~# apt list -a ssh
Listing... Done
ssh/hirsute-updates,hirsute-updates 1:8.4p1-5ubuntu1.1 all
ssh/hirsute,hirsute 1:8.4p1-5ubuntu1 all
Step 3: Check the status of ssh by using the following command
root@linuxhelp:~# systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-11-17 20:18:22 IST; 1h 38min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 5504 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 5505 (sshd)
Tasks: 1 (limit: 2257)
Memory: 1.0M
CGroup: /system.slice/ssh.service
└─5505 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
Nov 17 20:18:22 linuxhelp systemd[1]: Starting OpenBSD Secure Shell server...
Nov 17 20:18:22 linuxhelp sshd[5505]: Server listening on 0.0.0.0 port 22.
Nov 17 20:18:22 linuxhelp sshd[5505]: Server listening on :: port 22.
Nov 17 20:18:22 linuxhelp systemd[1]: Started OpenBSD Secure Shell server.
root@linuxhelp:~#
Step 4: Adding a new group named “sftpgroup” by using following command
root@linuxhelp:~# addgroup sftpgroup
Adding group `sftpgroup' (GID 1001) ...
Done.
Step 5: Create a new user named “sftpuser” with adding in “sftpgroup”
root@linuxhelp:~# useradd -m sftpuser -g sftpgroup
Step 6: Create password for the user “sftpuser” by using the following command
root@linuxhelp:~# passwd sftpuser
New password:
Retype new password:
passwd: password updated successfully
Step 7: Give permission 700 for the home directory to restrict access of other user
root@linuxhelp:~# chmod 700 /home/sftpuser/
Step 8: List the files to view permission changes
root@linuxhelp:~# ls -la /home/
total 16
drwxr-xr-x 4 root root 4096 Nov 17 21:58 .
drwxr-xr-x 20 root root 4096 Sep 8 16:50 ..
drwxr-x--- 14 linuxhelp linuxhelp 4096 Oct 22 15:57 linuxhelp
drwx------ 2 sftpuser sftpgroup 4096 Nov 17 21:58 sftpuse
Step 9: Create a file named “file” in sftpuser home directory
root@linuxhelp:~# touch /home/sftpuser/file
Step 10: Login to the sftp shell securely in client’s system
linuxhelp@linuxhelp2:~$ sftp sftpuser@192.168.6.115
sftpuser@192.168.6.115's password:
Connected to 192.168.6.115.
Step 11: List the files in the home directory
sftp> ls
file
By this Secure FTP setup on Ubuntu 21.04 has been completed.
Comments ( 0 )
No comments available