title: proftpd sftp CentOS permission denied
body: <p>I would like configure a server SFTP on CentOs. I've tested on Ubuntu server and it works very well!</p>
  
  <p>It seems that the location of users and the server have great importance.</p>
  
  <p>I create a folder <code>/sftp</code> in <code>/</code> and a user bob :</p>
  
  <pre><code>mkdir /sftp
  chmod 777 /sftp
  adduser --home /sftp bob
  </code></pre>
  
  <p>When I connect bob to the sftp server, and I use <code>ls</code>, I have the message "permission denied":</p>
  
  <pre><code>sftp -P 2222 bob@x.x.x.x 
  sftp&gt;ls
  remote readdir("/") : Permission denied
  </code></pre>
  
  <p>But know, if I change the location of the user bob in <code>/etc/passwd</code>, it Work !</p>
  
  <pre><code>chmod 777 /etc
  nano /etc/passwd
  bob:x:5000:99::/sftp:/bin/bash ---&gt; bob:x:5000:99::/etc:/bin/bash
  service proftpd restart
  
  # On client
  sftp -P 2222 bob@x.x.x.x 
  sftp&gt;ls
  files ...
  </code></pre>
  
  <p>So I can not create my server outside of <code>/etc</code>, <strong>Why?</strong> I have tested on different version of proftpd.</p>
  
  <p>Because I noticed on my Ubuntu server that works, if I place <code>/sftp</code> in <code>/etc</code> there are problems right to <code>put</code> command, but if I place <code>/sftp</code> in the root 'put' works well.</p>
  
  <p>My file proftpd.conf is the basic configuration :</p>
  
  <pre><code>## 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        ~
  </code></pre>