2014-04-28 18 views
0
拒絕「權限」與PROFTPD SFTP

我想配置一SFTP服務器的CentOS 6.但是當我用「放」與Filezila客戶,我有這樣的消息:獲取CentOS中

open for write: permission denied 

在我的日誌SFTP我有這樣的,當我用「把」:

... 
unsupported '[email protected]' 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 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(日誌文件罷了),但是當我在一個服務器上創建一個文件「測試」,在filezila文件我不能使用「放」 ..被重命名「艾薇28 12 :45考」 ..

文件

權限/ home是777

這是本proftpd.conf中:發現

# This is the ProFTPD configuration file 
ServerName   "ProFTPD server" 
ServerIdent   on "FTP Server ready." 
ServerAdmin   [email protected] 
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 
.... 
+0

我試着用虛擬用戶,但它仍然無法正常工作.. – user3581358

回答

-2

解決方案! CentOS的安全服務限制訪問某個目錄。所以只是爲了禁用。

nano /etc/selinux/config 
SELINUX=disabled 
#reboot system 
+0

-1禁用SELinux不安全的服務器。首先轉到/ etc/selinux/config並配置SELINUX = permissive,而不是SELINUX = enforcing – Mike

0

默認情況下,SElinux保護您的服務器並禁止訪問目錄。

您可以通過使用chcon創建規則來允許訪問。

實施例用於web站:

  • 測試selinux的右:LS -dZ /家/ myusergrp /爲myuser/FTP
  • 允許訪問權:chcon這個-R -t httpd_sys_content_t /家/ myusergrp /爲myuser/FTP

不要除去的selinux,prefert去到/ etc/selinux的/配置和配置SELINUX =許可代替SELINUX =執行(並重新引導服務器)。它會向您顯示所有訪問問題,您可以解決問題,並在解決問題後重新啓用強制模式。

要知道更多:http://selinuxproject.org/page/FTPRecipes

我希望這種幫助, 邁克