centos에서 /var/www/에 대한 proftpd 사용자 액세스 구성

centos에서 /var/www/에 대한 proftpd 사용자 액세스 구성

시스템 사용자가 centos 상자의 /var/www/에 액세스할 수 있도록 proftpd를 구성하는 데 문제가 있습니다.

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>

나는 홈 디렉토리가 /var/www/이고 유효한 쉘을 사용하여 시스템 사용자 'ftpuser'를 만들었습니다. 이 사용자로 SSH에 접속하여 올바른 디렉토리 등을 볼 수 있습니다.

그러나 FTP 클라이언트를 사용하여 쉘에서 localhost에 연결하거나 연결하려고 하면 오류가 발생합니다.

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

또는:

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

여기서 무슨 일이 일어나고 있는지, 해결 방법을 아는 사람이 있나요?

답변1

SElinux가 문제를 일으키지 않는지 확인하세요.

setenforce 0

문제가 해결되면 SELinux를 다시 켜고( setenforce 1) ftp_home_dir 부울을 설정해 보십시오.

setsebool -P ftp_home_dir on

그러면 ftp 데몬이 사용자 홈 디렉토리에 액세스할 수 있습니다.

관련 정보