LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1493|回复: 7

我配置的vsftpd怎么登陆不了。(已经解决了)

[复制链接]
发表于 2005-5-12 20:08:41 | 显示全部楼层 |阅读模式
我的是hoary
apt安装了vsftpd
然后vi vsftpd.conf(这个是抄网络一个人的例子,据说可以匿名登陆和上传。url:http://www.gzicp.com/tech/setup/vsftpd/1087783980360.shtml)
root@huang:/etc # vi vsftpd.conf
[PHP]anonymous_enable=YES  
local_enable=YES  
write_enable=YES  
local_umask=022  
anon_upload_enable=YES  
anon_mkdir_write_enable=YES  
dirmessage_enable=YES  
xferlog_enable=YES  
connect_from_port_20=YES  
chown_uploads=YES  
chown_username=root  
xferlog_file=/var/log/vsftpd.log  
xferlog_std_format=YES  
pam_service_name=vsftpd  
chroot_local_user=YES[/PHP]
其他的,除了把/home/ftp目录chmod 777外,我久什么也没有改了。
然后用gfp登陆,ip:192.168.6.44。port:21。登陆名:anonymous 密码:无,直接回车。
但是登陆不了,错误信息为:
正在查阅 192.168.6.44
尝试 huang:21
无法连接到 huang:拒绝连接
等待 30 秒再重新尝试连接
发表于 2005-5-12 21:51:00 | 显示全部楼层
不要老是抄别人的配置啊,默认的安装就是只允许匿名登陆的!你的服务器不是用pam认证虚拟用户干嘛打开
pam_service_name=vsftpd啊,注销掉!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-12 22:12:53 | 显示全部楼层
我注销了pam_service_name=vsftpd,结果一样的,还是登陆不上。
错误信息为:
正在查阅 192.168.6.44
尝试 huang:21
无法连接到 huang:拒绝连接
等待 30 秒再重新尝试连接

我又把vsftpd默认的vsftpd.conf备份回来,也是登陆不了。错误信息为:
正在查阅 192.168.6.44
尝试 huang:21
已连接到 192.168.6.44:21
220 (vsFTPd 2.0.1)
USER anonymous
331 Please specify the password.
PASS xxxx
500 OOPS: vsftpd: refusing to run with writable anonymous root
正在断开与站点 192.168.6.44 的连接
回复 支持 反对

使用道具 举报

发表于 2005-5-12 23:06:45 | 显示全部楼层
不要把/home/ftp的目录改成+777 应该在ftp的目录里面建立一个upload的目录,将这个目录改成777让别人上传就好了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-12 23:58:28 | 显示全部楼层
Post by qazwer
不要把/home/ftp的目录改成+777 应该在ftp的目录里面建立一个upload的目录,将这个目录改成777让别人上传就好了。


谢谢。我按照你说的改了,现在可以登陆上了

我试着上传一个文件到upload,但是结果是:
无法将本地目录更改为 /home/andey/need to blog.txt:不是目录(见抓图1)
我有传一个目录,结果说:
PWD

257 "/upload"
正在从服务器上装入目录列表 /upload(LC_TIME=zh_CN.UTF-8)
PASV

227 Entering Passive Mode (192,168,6,44,107,149)
LIST -aL

150 Here comes the directory listing.
226 Directory send OK.
但是我的/home/ftp/upload下面并没有我上传的文件阿。(图2)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-14 17:16:12 | 显示全部楼层
已经参照了南北的精华贴:
http://www.linuxsir.cn/bbs/showt ... mp;highlight=vsftpd
不过他说的是redhat,我ubuntu安装了和他说的很多不同。

匿名用户还是上传不了阿。
我/home/ftp建立了一个upload ,chmod它 为777
我可以登陆我的ftp,可以下载/home/ftp/下的文件,但是却上传不了文件到/home/ftp/upload/
如果上传文件,gftp说:
收到 URL file:///home/andey/ding.txt~
无法将本地目录更改为 /home/andey/ding.txt~:不是目录

如果上传一个目录,则gftp说:
收到 URL file:///home/andey/txt/
将本地目录更改为 /home/andey/txt 成功
正在从缓存中装入目录列表 /upload(LC_TIME=zh_CN.UTF-8)
将本地目录更改为 /home/andey/txt 成功
将本地目录更改为 /home/andey 成功
MKD /upload/txt

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,101,3)
STOR /upload/txt/ding.txt

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,102,47)
STOR /upload/txt/geci.txt

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,78,98)
STOR /upload/txt/xmame-doc.pdf

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,147,167)
STOR /upload/txt/how  you remind me .txt

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,141,160)
STOR /upload/txt/geci.txt~

550 Permission denied.
PASV

227 Entering Passive Mode (192,168,6,44,111,44)
STOR /upload/txt/need to blog.txt

550 Permission denied.
正在从服务器上装入目录列表 /upload(LC_TIME=zh_CN.UTF-8)
PASV

227 Entering Passive Mode (192,168,6,44,78,128)
LIST -aL

150 Here comes the directory listing.
226 Directory send OK.
==============================================================


我的vsftpd.conf是这样子的
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
#local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
#write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#pam_service_name=vsftpd
userlist_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_umask=022
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-15 00:07:46 | 显示全部楼层
感谢北南大老的指教!!!
方法步骤如下:
把ubuntu的那个remove了
下载:vsftpd-2.0.3.tar.gz后解压
进入安装目录
#vi builddefs.h
#define VSF_BUILD_PAM改为 #undef  VSF_BUILD_PAM    #把PAM验证关掉
#make
#make install #有错误也不管
#cp vsftpd.conf /etc/


#vi /etc/vsftpd.conf
------------------------------------------------
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
anon_umask=022  #这个在local_umask=022后面
anon_upload_enable=YES
anon_mkdir_write_enable=YES
listen=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
------------------------------------------------------------
#mkdir /home/ftp
chown root:root /home/ftp   #ftp目录属主要是root
chmod 755 /home/ftp    #绝对不能是777
root@huang:/home # ls -l ftp
drwxr-xr-x   4 root  root   168 2005-05-14 23:26 ftp
mkdir /home/ftp/upload    #上传目录
chmod 777 /home/ftp/upload    #一定要是777
#pkill vsftpd
#vsftpd&
用gftp联接ftp,如果说:
500 OOPS: vsftpd: not found: directory given in 'secure_chroot_dir':/usr/share/empty
则自己建立一个empty目录。
#mkdir /usr/share/empty
再试试,应该可以了吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-15 00:10:27 | 显示全部楼层
总结:ubuntu apt安装的那个需要pam验证,整个pam不知道怎么去掉
另外ubuntu安装那个不能上传的原因很有可能是/home/ftp的属主不是root
也就是没有执行chown root:root /home/ftp这个命令。
另外以前apt安装的一直用gftp来试上传,因为没有去掉gftp的被动模式,所以也有可能apt安装的那个根本没有问题。只是gftp没有设置好。汗~~~~~~~!!!!所以以后最好text模式实验ftp。

算了,现在可以上传了,而且经过这一躺,对vsftpd也了解多了些。
载再次感谢北南及其他帮忙的兄弟。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表