简体   繁体   中英

proftpd sftp CentOS permission denied

I would like configure a server SFTP on CentOs. I've tested on Ubuntu server and it works very well!

It seems that the location of users and the server have great importance.

I create a folder /sftp in / and a user bob :

mkdir /sftp
chmod 777 /sftp
adduser --home /sftp bob

When I connect bob to the sftp server, and I use ls , I have the message "permission denied":

sftp -P 2222 bob@x.x.x.x 
sftp>ls
remote readdir("/") : Permission denied

But know, if I change the location of the user bob in /etc/passwd , it Work !

chmod 777 /etc
nano /etc/passwd
bob:x:5000:99::/sftp:/bin/bash ---> bob:x:5000:99::/etc:/bin/bash
service proftpd restart

# On client
sftp -P 2222 bob@x.x.x.x 
sftp>ls
files ...

So I can not create my server outside of /etc , Why? I have tested on different version of proftpd.

Because I noticed on my Ubuntu server that works, if I place /sftp in /etc there are problems right to put command, but if I place /sftp in the root 'put' works well.

My file proftpd.conf is the basic configuration :

## basic config ...

SFTPEngine         on
Port               2222

SFTPLog            /var/log/proftpd/sftp.log
TransferLog        /var/log/proftpd/sftp-xferlog

# Host Keys
SFTPHostKey        /etc/ssh/ssh_host_rsa_key
SFTPHostKey        /etc/ssh/ssh_host_dsa_key

# Auth methods
SFTPAuthMethods    password
AuthUserFile       /etc/proftpd/sftp.passwd

# SFTP specific configuration
DefaultRoot        ~

Solution found! The security service CentOS of restricts access to some directory. So just to disable.

nano  /etc/selinux/config
SELINUX=disabled
#reboot system

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM