Konfigurieren des Proftpd-Benutzerzugriffs für /var/www/ in CentOS

Konfigurieren des Proftpd-Benutzerzugriffs für /var/www/ in CentOS

Ich habe Probleme, proftpd so zu konfigurieren, dass einem Systembenutzer auf einer CentOS-Box Zugriff auf /var/www/ gewährt wird.

proftpd.conf

ServerName                      "ProFTPD server"
ServerIdent                     on "FTP Server ready."
ServerAdmin                     root@localhost
ServerType                      standalone
DefaultServer                   on
VRootEngine                     on
#DefaultRoot                    ~ !adm
DefaultRoot                     /var/www/
VRootAlias                      /etc/security/pam_env.conf etc/security/pam_env.conf
AuthPAMConfig                   proftpd
AuthOrder                       mod_auth_pam.c* mod_auth_unix.c
#PersistentPasswd               off
UseReverseDNS                   off
User                            nobody
Group                           nobody
MaxInstances                    20
UseSendfile                     off
LogFormat                       default "%h %l %u %t \"%r\" %s %b"
LogFormat                       auth    "%v [%P] %h %t \"%r\" %s"

<Global>
  Umask                         022
  AllowOverwrite                yes
  <Limit ALL SITE_CHMOD>
    AllowAll
  </Limit>
</Global>

<Limit LOGIN>
AllowUser ftpuser
DenyALL
</Limit>

Ich habe einen Systembenutzer „ftpuser“ mit dem Home-Verzeichnis /var/www/ und einer gültigen Shell erstellt. Ich kann mich als dieser Benutzer per SSH anmelden und die richtigen Verzeichnisse usw. anzeigen.

Wenn ich jedoch versuche, über einen FTP-Client eine Verbindung herzustellen oder sogar von einer Shell aus eine Verbindung zum lokalen Host herzustellen, erhalte ich folgende Fehlermeldungen:

Status: Connecting to 10.0.10.10:21...
Status: Connection established, waiting for welcome message...
Response:   220 FTP Server ready.
Command:    USER ftpuser
Response:   331 Password required for ftpuser
Command:    PASS *******
Response:   230 User ftpuser logged in
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PASV
Response:   227 Entering Passive Mode (10,0,10,10,184,18).
Command:    MLSD
Response:   550 /: Invalid argument
Error:  Failed to retrieve directory listing

oder:

telnet localhost 21
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 FTP Server ready.
user ftpuser
331 Password required for ftpuser
pass PASSWD
230 User ftpuser logged in
LIST
425 Unable to build data connection: Invalid argument
MLSD
550 /: Invalid argument

Weiß jemand, was hier passiert und wie man es behebt?

Antwort1

Überprüfen Sie, ob SElinux Ihnen keine Probleme bereitet

setenforce 0

Wenn das Problem dadurch behoben wird, schalten Sie SELinux wieder ein ( setenforce 1) und versuchen Sie dann, den booleschen Wert ftp_home_dir festzulegen.

setsebool -P ftp_home_dir on

Dadurch kann der FTP-Daemon auf die Home-Verzeichnisse der Benutzer zugreifen.

verwandte Informationen