1

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        ~
user3581358
  • 25
  • 2
  • 5
  • Isn't this a duplicate of the question you asked before this, [PROFTPD SFTP permission denied centos](http://stackoverflow.com/questions/23341999/proftpd-sftp-permission-denied-centos)? Your self-answer is the same in both cases. – halfer Dec 24 '14 at 16:16

1 Answers1

0

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

nano  /etc/selinux/config
SELINUX=disabled
#reboot system
user3581358
  • 25
  • 2
  • 5