作者:王-闻 | 来源:互联网 | 2014-05-28 09:12
emerge-sproftpd#查找看下有没有proftpdemerge-avproftpd#加了a参数会征求下你的意见结果我的报错了,可能其他人没有这种错误,!!!Theebuildselectedtosatisfyproftpdhasunmetrequirements.-net-ftp/proftpd-1.3.4c
emerge -s proftpd # 查找看下有没有proftpd
emerge -av proftpd # 加了a参数会征求下你的意见
结果我的报错了,可能其他人没有这种错误,
!!! The ebuild selected to satisfy "proftpd" has unmet
requirements.
- net-ftp/proftpd-1.3.4c::gentoo USE="caps ipv6 mysql ncurses
pcre ssl tcpd (uclibc) -acl -authfile -ban -case -clamav -copy
-ctrls -deflate -diskuse -doc -dso -exec -ident -ifsession
-ifversion -kerberos -ldap -memcache (-nls) -openssl (-pam)
-postgres -qos -radius -ratio -readme -rewrite (-selinux) -sftp
-shaper -sitemisc -softquota -sqlite -test -trace -vroot -xinetd"
LINGUAS="-bg_BG -en_US -fr_FR -it_IT -ja_JP -ko_KR -ru_RU -zh_CN
-zh_TW"
The following REQUIRED_USE flag constraints are
unsatisfied:
ssl? ( openssl )
The above constraints are a subset of the following
complete expression:
ban? ( ctrls ) sftp? ( openssl ) shaper? ( ctrls )
ssl? ( openssl )
打开/etc/make.conf, USE中加入openssl 标记,再运行emerge -av proftpd,ok
配置:在/etc/proftpd/有一个proftpd.conf.sample里面配置例子文件,复制到/etc/proftpd/proftpd.conf,对proftpd.conf文件进行相关配置,如下:
# This is a sample ProFTPD configuration file for Gentoo Linux
(rename
# it to 'proftpd.conf' for actual use). It establishes a single
server
# and a single anonymous login.
ServerName "ftp Server"
ServerType standalone
DefaultServer on
RequireValidShell off
#AuthPAM on
#AuthPAMConfig ftp
RequireValidShell off
# Listen on the standard FTP port 21.
Port 21
# New directories and files should not be group or world
writable.
Umask 022
# To prevent DoS attacks set the maximum number of child
processes
# to 30. If you need to allow more than 30 concurrent
connections
# at once simply increase this value.
MaxInstances 30
# The server will run under ftp/ftp.
User ftp
Group ftp
# Every FTP sessions is "jailed" into the user's home
directory.
DefaultRoot ~
# Generally files are overwritable.
AllowOverwrite on
# Disallow the use of the SITE CHMOD command.
DenyAll
SystemLog
/var/log/proftpd.syslog
TransferLog
/var/log/proftpd.transferlog
# A basic anonymous FTP account without an upload directory.
User ftp
Group ftp
# Clients can login with the username "anonymous" and
"ftp".
UserAlias anonymous ftp
# Limit the maximum number of parallel anonymous logins
to 10.
MaxClients 10
# Prohibit the WRITE command for the anonymous users.
DenyAll
Order
deny,allow
Allow
from all
配置好之后,可以使用/usr/sbin/proftpd -t 对配置文件进行检查,如果不正确,则会提示错误的信息
上述的配置没有对访问进行限制,任何人都可以访问,
检查配置正确之后,启动ftp服务器
/etc/init.d/proftpd start
显示: * Starting ProFTPD ... 表示启动成功
测试
打开浏览器或计算机(我的电脑xp)在地址栏输入ftp://主机IP/ 即可看到ftp根目录的信息,默认的根目录在
/home/ftp
创建只能访问ftp不能访问主机普通用户(ftp服务器默认可以通过普通的账号和密码来访问该帐户的家目录)
useradd asan -g groupname -d ftpdir(目录) -s /sbin/nologin
#后面的shell很重要,如果你整成为/bin/bash或其他存在的shell,则该账户就能够通过ssh连接上主机。
在配置文件中 中改为如下
Order
deny,allow
#Allow
from all
DenyUser
!asan
再次访问ftp服务器时,就会要求用户名和密码,输入即可访问,如果出现文件无法下载的情况,请检查创建帐户的目录里面的文件是否属于该用户且可读。