我已经build立了一个新的proftpd服务器与mod_sftp SSH支持,我可以login到我使用密码时。 但是,当我尝试使用我的SSH密钥,我无法连接。
以下是完整的proftpd.conf文件:
[root@myers log]# cat /usr/etc/proftpd.conf ServerName "Develop CENTS" ServerType standalone DefaultServer on Port 2215 UseIPv6 off # Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. Umask 022 MaxInstances 15 User nobody Group nobody DefaultRoot ~ AllowOverwrite on # Bar use of SITE CHMOD by default <Limit SITE_CHMOD> DenyAll </Limit> <IfModule mod_auth_pam.c> AuthPAM off </IfModule> <IfModule mod_sftp.c> SFTPEngine on SFTPHostKey /usr/etc/proftpd/rsa_key SFTPHostKey /usr/etc/proftpd/dsa_key Port 2216 SFTPAuthMethods publickey MaxLoginAttempts 4 SFTPCompression delayed <VirtualHost www.mydomain.com> SFTPAuthorizedUserKeys file:/home/mydomain.com/.ssh/authorized_keys DefaultRoot ~ </VirtualHost> </IfModule>
下面是我在/ var / log / messages中看到的一行,不pipe使用哪种validation方法:
Mar 19 10:41:51 myers proftpd[29675]: myhost.com - unable to create namebind for 'www.mydomain.com' to IPAddress#21: No such file or directory
除此之外,当我尝试使用SSH密钥连接时,唯一出现在日志文件中的是客户端到达服务器并打开了SSH2会话,但下一行指示SSH2会话已closures。
有任何想法吗?
从你的configuration看来,你需要一个普通的FTP服务器在端口2215上,而SFTP服务器在2216端口上。为了做到这一点,你需要在自己的<VirtualHost>部分configurationmod_sftp 。 如同你的configuration,两个Port指令都出现在同一个“虚拟主机”上下文中,因此在parsingconfiguration时,ProFTPD可能不会达到你所期望的。 我会build议使用像这样的东西:
# ... previous config ... <IfModule mod_auth_pam.c> AuthPAM off </IfModule> <IfModule mod_sftp.c> # Here we give mod_sftp its own explicit vhost, and put all of # of the mod_sftp configuration within that <VirtualHost> section. <VirtualHost www.mydomain.com> Port 2216 SFTPEngine on SFTPHostKey /usr/etc/proftpd/rsa_key SFTPHostKey /usr/etc/proftpd/dsa_key SFTPAuthMethods publickey MaxLoginAttempts 4 SFTPCompression delayed SFTPAuthorizedUserKeys file:/home/mydomain.com/.ssh/authorized_keys DefaultRoot ~ </VirtualHost> </IfModule>
希望这可以帮助!
Mar 19 10:41:51 myers proftpd[29675]: myhost.com - unable to create namebind for 'www.mydomain.com' to IPAddress#21: No such file or directory
这只是一个美容警告。 据我所知,你正在使用proftpd-1.3.5。
作为1.3.5最终工作的一部分,我开始添加一些支持HOST命令(RFC 7151)的基础,这将为FTP提供基于名称的虚拟主机支持。 那添加的代码是在这里抱怨的(错误的)。 我修正了这个错误地在GitHub的master分支上logging了NOTICE级日志消息的代码。 我也会更新1.3.5分支,以便这个消息没有被logging下来,因为下一个maint发布(现在应该很快)。