• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to setup Secure FTP on Ubuntu 21.04

  • 00:48 lsb_release -a
  • 01:08 apt list -a ssh
  • 01:22 systemctl status ssh
  • 02:05 useradd -m sftpuser -g sftpgroup
  • 03:11 chmod 700 /home/sftpuser/
  • 04:00 touch /home/sftpuser/file
  • 04:35 sftp sftpuser@192.168.6.115
{{postValue.id}}

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.

Tags:
owen
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What port does the sftp use?

A

Sftp uses port 22 to transfer data.

Q

What are the pros of sftp over FTP?

A

Sftp encrypts the data while FTP doesn't encrypt.

Q

Does SFTP allows data on both ways?

A

Yes the TCP sftp allows both sides to send data anytime

Q

How many ports do the sftp use?

A

Unlike FTP, sftp uses only one port.

Q

What does mean sftp?

A

Sftp means Secure file transfer protocol and it is also called SSH file transfer protocol.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Gibbson ?
How do i run both nginx and apache in same instance on centos

Hi...,

my server is based centos operating system and my webserver is already running on Apache.... i need to run both apache and nginx on same instance ... please help me to implement this concept...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.