To set up an SFTP server on AlmaLinux 9, follow these steps:
Step 1 : Check if SSH is Running
Run the following command to ensure the SSH service is active:
Step 2 : Configure SSH for SFTP
Edit the SSH configuration file:
Add or modify the following lines at the end of the file:
Step 3 : Enable Password Authentication (Optional)
If you want to allow password-based login, ensure the following line is set to yes
:
Step 4 : Restart SSH Service
Apply the changes by restarting the SSH service:
Step 5 : Create an SFTP Group
Create a dedicated group for SFTP users:
Step 6 : Create an SFTP User
Add a new user and assign them to the SFTP group:
Step 7 : Set a Password for the User
Assign a password to the SFTP user:
Step 8 : Assign User to SFTP Group
Ensure the user is part of the sftpgroup
:
Step 9 : Configure Permissions
Set proper permissions to restrict user access:
Step 10 : Restart SSH Service
Restart the SSH service again to apply the changes:
Step 11 : Test SFTP Connection
- Open an SFTP Client (e.g., FileZilla)
- Add a New Site
Enter "Host" (Server IP or Domain)
Select "SFTP - SSH File Transfer Protocol"
Set "Port" to 22
Choose "Normal" and enter username & password
- Click "Connect"
- If prompted with an "Unknown Host Key" warning, click "OK"
Congratulations! You have successfully set up an SFTP server on AlmaLinux 9.