Thursday, February 13, 2025

Creating a sftp server on Oracle Linux compute instance on OCI

Creating a sftp server on Oracle Linux compute instance on OCI

Installing the SFTP service on Oracle Linux

Use this command to install vsftpd service on Oracle Linux 
dnf install vsftpd -y
Please find below screenshot for the reference.



Configuring SFTP.
Go to the /etc/vsftpd  take a back up of vsftpd.conf file. Open  vsftpd.conf file with vi and add following line at the end of the file.         

userlist_deny=NO


Creating the blftpusr user that we will use to access sftp.


Adding the user blftpusr in user_list file to have access to sftp.

Use below command to add user in user_list file. 
echo "blftpusr" | sudo tee -a /etc/vsftpd/user_list



Enable Password Authentication.

As at OCI we access linux environments with a private key, we will have to adjust it so that the user can access by password and not by private key.

Edit the sshd_config file and make the parameter "PasswordAuthentication yes" as shown in below screenshot.



Add AllowUsers tag in sshd_config file as shown in below screenshot.



Now, restart sshd service with following command.

systemctl restart sshd.service


Enabling and starting the sftp service.

Use systemctl enable vsftpd command to enable the vsftpd service.

Then run the systemctl start vsftpd command to start the vsftpd service.

Next check the status of vsftpd service with systemctl status vsftpd command. Make sure it is in active and running status as shown in below screenshot.
       

Now Test the SFTP

In my environment I am testing access using filezilla with sftp on the public ip of the instance.

Hope this article helps to build sftp server with compute instance on OCI.

Thanks & Regards,
Chandan Tanwani