Problem
Getting below error after connecting to SFTP server:
# sftp sftp_user1@dbappweb.com
sftp_user1@dbappweb.com's password:
Connected to dbappweb.com.
sftp> ls
remote readdir("/incoming"): Permission denied
Reason
I was getting the “Permission denied” error because SELinux was enabled on the SFTP servers and it was enforcing. The status of SELinux can be checked using getenfore command:
# getenforce Enforcing
Solution
I have set up an SFTP server and created some SFTP users to access their home directories only using chroot. After configuring the setup below commands need to be run to resolve the above error.
# setsebool -P ssh_chroot_rw_homedirs on # restorecon -R /home/sftp/sftp_user1
Where /home/sftp/sftp_user1 is the home directory of the SFTP user sftp_user1.
After executing the above command for SFTP user sftp_user1, the user is able to access files and folders under the home directory.
# sftp sftp_user1@dbappweb.com sftp_user1@dbappweb.com's password: Connected to dbappweb.com. sftp> ls incoming
Related Posts
Last Updated: May 18, 2020
No Responses