This guide will walk you through the process of setting up SFTP on your server. SFTP (Secure File Transfer Protocol) is a secure way to transfer files over a network.
Prerequisites
- A server with SSH access
- SFTP server software installed (e.g., OpenSSH, vsftpd)
Steps
Install SFTP Server Software
Depending on your operating system, the installation process will vary. Here's an example for installing OpenSSH on Ubuntu:
sudo apt update sudo apt install openssh-server
Configure SSH
Edit the SSH configuration file to allow SFTP connections:
sudo nano /etc/ssh/sshd_config
Look for the following lines and ensure they are uncommented and set to
yes
:PermitRootLogin no PermitSFTPLogin yes
Save and close the file.
Create a User
Create a new user for SFTP access:
sudo adduser sftpuser
Set a password for the user.
Set Permissions
Set the appropriate permissions for the user's home directory:
sudo chown -R sftpuser:sftpuser /home/sftpuser
Start the SFTP Service
Restart the SSH service to apply the changes:
sudo systemctl restart ssh
Connect to SFTP
Use an SFTP client (e.g., FileZilla, WinSCP) to connect to your server. Enter the server's IP address, username, and password.
Troubleshooting
If you encounter any issues, check the following:
- Ensure the SFTP server software is running.
- Verify the SSH configuration file settings.
- Check the user's permissions and home directory.
For more detailed troubleshooting, refer to our SSH Troubleshooting Guide.