CentOS 6 で SFTP サーバーを構成したいのですが、Filezila クライアントで「put」を使用すると、次のメッセージが表示されます。
open for write: permission denied
私のログ sftp では、「put」を使用すると次のようになります。
...
unsupported 'simply@putty.projects.tartarus.org' channel requested, ignoring
'subsystem' channel request for 'sftp' subsystem
..
error checking 'namefile' for REALPATH : Aucun fichier ou dossier de ce type
error opening 'filename'; Permission non accordée
Debianでは非常にうまく機能するため、わかりません...
Proftpd をインストールします。
sudo rpm –Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum install proftpd
私のテストでは、ファイアウォールをブロックしました:
service iptables stop
ssh構成ファイル「sshd_config」の「Subsystem」行にコメントを付けました
# Subsystem sftp ....
proftpd 設定ファイル "proftpd.conf" に次の行を追加します。
nano /etc/proftpd.conf
LoadModule mod_sftp.c
LoadModule mod_sftp_pam.c
<IfModule mod_sftp.c>
# On écoute sur le port 2222
Port 2222
# On active le mode SFTP
SFTPEngine on
# Emplacement des clés de cryptage
SFTPHostKey /etc/ssh/ssh_host_rsa_key2
SFTPHostKey /etc/ssh/ssh_host_dsa_key2
# Pour le moment, on met authentification par mot de passé
# On changera après par authentification par clé
SFTPAuthMethods password
# L’utilisateur est bloqué au repertoire qu’on lui a attribué
lors de sa création
DefaultRoot ~
# On ajoute les fichiers log pour le sftp
SFTPLog /etc/sftp/log/sftp.log
TransferLog /etc/sftp/log/sftp-transfer.log
</IfModule>
新しいユーザーと新しいグループを追加します:
groupadd upload
adduser --home /etc/sftp/home nom_utilisateur
# On associe le nouvel utilisateur à un des groupes (upload ou download)
usermod –g nom_groupe nom_utilisateur
SFTP に接続できます (ログ ファイルがいっぱいになります) が、"put" を使用できません.. サーバーで "test" ファイルを作成すると、filezila でファイルの名前が "avril 28 12:45 test" に変更されます..
ファイル /home のパーミッションは 777 です。
これはこの proftpd.conf です:
# This is the ProFTPD configuration file
ServerName "ProFTPD server"
ServerIdent on "FTP Server ready."
ServerAdmin root@localhost
DefaultServer on
VRootEngine on
VRootAlias /etc/security/pam_env.conf etc/security/pam_env.conf
# Use pam to authenticate (default) and be authoritative
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_unix.c
# If you use NIS/YP/LDAP you may need to disable PersistentPasswd
PersistentPasswd off
# Don't do reverse DNS lookups (hangs on DNS problems)
UseReverseDNS off
# Set the user and group that the server runs as
User nobody
Group nobody
# Disable sendfile by default since it breaks displaying the download speeds in
# ftptop and ftpwho
UseSendfile on
# Define the log formats
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LoadModule mod_sftp.c
LoadModule mod_sftp_pam.c
# Dynamic ban lists (http://www.proftpd.org/docs/contrib/mod_ban.html)
# Enable this with PROFTPD_OPTIONS=-DDYNAMIC_BAN_LISTS in /etc/sysconfig/proftpd
<IfDefine DYNAMIC_BAN_LISTS>
LoadModule mod_ban.c
BanEngine on
BanLog /var/log/proftpd/ban.log
BanTable /var/run/proftpd/ban.tab
BanOnEvent MaxLoginAttempts 2/00:10:00 01:00:00
BanControlsACLs all allow user ftpadm
</IfDefine>
<Global>
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable
Umask 022
# Allow users to overwrite files and change permissions
AllowOverwrite on
<Limit ALL SITE_CHMOD>
AllowAll
</Limit>
</Global>
## SFTP
....