歡迎您光臨本站 註冊首頁

用VSFTP架設FTP伺服器后,客戶端還是連接不上呀。

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

用VSFTP架設FTP伺服器后,客戶端還是連接不上呀。

問題如下:
      我用的是Centos5.3,自帶的vsftp軟體架設的FTP伺服器,照著網上的很多教程設置了以後,檢查
chkconfig --list vsftpd
vsftpd          0:關閉  1:關閉  2:啟用  3:啟用  4:啟用  5:啟用  6:關閉

說明vsftp服務已經啟動,可是按照網上的一篇文章用pgrep vsftpd查看后,顯示:
7470

而按照http://www.linuxsir.org/main/?q=node/152#7 這個網頁上面的說法,要顯示成4248才表示成功,也不知道是怎麼回事,

用客戶端cuteffp連接時顯示:
STATUS:>          Getting listing ""...
STATUS:>          Connecting to FTP server... 61.234.97.2:21 (ip = 61.234.97.2)...
STATUS:>          Socket connected. Waiting for welcome message...
ERROR:>           Can't read from control socket. Socket error = #10054.

然後,又懷疑是防火牆的緣故,用service iptables stop,將防火牆給關了,但是運行cutftp時,還是顯示上面的錯誤,也看了許多文章,還是搞不掂,linux真的不一般人能學的。
《解決方案》

後來又重新測試了一下,在本機上用ftp 192.168.0.3 這樣是可以上去的,但用客戶端cuteFTP就登錄不上去了。
《解決方案》

xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES

把配置文件的三句的註釋去掉,重啟服務,重新登陸。
貼出log: tail -f =/var/log/vsftpd.log
《解決方案》

vsftp架設好之後~用ftp命令能登陸上去~但是無法刪除文件~客戶端就可以~~為什麼呢?
《解決方案》

原帖由 linuxsoso 於 2009-4-11 14:38 發表 http://bbs3.chinaunix.net/images/common/back.gif
vsftp架設好之後~用ftp命令能登陸上去~但是無法刪除文件~客戶端就可以~~為什麼呢?

在命令行執行刪除操作,有什麼提示?在日誌又有什麼反映?
《解決方案》

remove directory operation failed~~~
xferlog沒什麼反映。。
《解決方案》

原帖由 linuxsoso 於 2009-4-11 15:03 發表 http://bbs3.chinaunix.net/images/common/back.gif
remove directory operation failed~~~
xferlog沒什麼反映。。


您是怎麼刪除的?


我在我這裡用delete **** 是可以刪除的。

我的vsftpd.conf 如下:

# Example config file /etc/vsftpd/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.
#
# 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 on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#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 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
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#listen_port=1212
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

chroot_local_user=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
《解決方案》

我發現有可能是路郵器的地址映射的問題:
因為查看cuteftp的連接信息,其中進行到這裡的時候就報錯了:
COMMAND:>        LIST
STATUS:>          Connecting FTP data socket... 61.234.97.4:35642...

在路郵器上,我只映射了20-21埠到伺服器上去,其他埠沒有映射,但這句「61.234.97.4:35642」 後面表明data socket是用了35642埠,這個埠我也沒有做映射,應該是不通的,
又進一步發現,這個埠是經常變的,
每次連接的時候都不同,這該怎麼辦。
《解決方案》

我日他媽!!!!!

經過網上查資料及看cuteftp提示,終於搞掂,內網能連接,外網不行,初步斷定是路郵器的埠映射的問題,然後就是pasv模式與port模式的問題,多方測試,需要設置如下:

在/etc/vsftpd/vsftpd.conf配置文件里,保證有以下幾項:
pasv_enable=YES                 //這個就是開啟pasv模式,好象cuteftp怎是優先用此模式連接;
pasv_min_port=65500         //這個埠是動態分配的,每次用cuteftp連接時,都會不同,所以要指定最小埠號與最大埠號;
pasv_max_port=65535

然後就是在路郵器中進行設置:將外網65500 ~ 85535這個段的埠全部映射到內網某台計算機的65500 ~ 85535埠號上;

重啟路郵器;
重啟vsftp伺服器,OK,搞掂!

Linux真他媽難呀,不過,經過這一番努力,好象知道了一些原理:outu:
《解決方案》

回復 #9 零度出土 的帖子

ls 的探索精神真可貴:mrgreen:


或者您用主動模式,就不用開那麼映射那麼多埠啊

[火星人 ] 用VSFTP架設FTP伺服器后,客戶端還是連接不上呀。已經有1020次圍觀

http://coctec.com/docs/service/show-post-23336.html