Я хочу настроить пользователя ftpuser на sftp для существующего каталога, принадлежащего apache /var/www/webiste
Я добавил его в качестве нового пользователя и сделал /var/www/webiste его домашним каталогом,
useradd -md /var/www/website -s /bin/bash ftpuser
в sshd_config:
Subsystem sftp internal-sftp
Match User ftpuser
ChrootDirectory /var/www/website
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Каталог теперь принадлежит root, и у него есть разрешения acl для пользователя www-data:
# ls -ltr
drwxrwx---+ 5 root root 4096 Nov 8 2012 website
# getfacl website/
# file: website/
# owner: root
# group: root
user::rwx
user:www-data:rwx
group::rwx
group:www-data:rwx
Но всякий раз, когда я пытаюсь подключиться к SFTP, я получаю следующие ошибки отладки:
ftpuser@ftp_server's password:
debug3: packet_send2: adding 32 (len 80 padlen 16 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to ftp_server ([ftp_server]:22).
debug2: fd 4 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)
debug1: fd 0 clearing O_NONBLOCK
debug3: fd 1 is not O_NONBLOCK
Connection to 104.237.139.76 closed by remote host.
Transferred: sent 2408, received 2020 bytes, in 0.0 seconds
Bytes per second: sent 627244.1, received 526176.5
debug1: Exit status -1
Couldn't read packet: Connection reset by peer
Есть идеи для устранения этой проблемы?
Править:
из /var/log/authz:
fatal: bad ownership or modes for chroot directory component "/var/www/"