5000|3

1560

帖子

24

TA的资源

五彩晶圆(初级)

楼主
 

BB Black 入门基础之FTP服务器配置 [复制链接]

那啥,感谢大家的支持,趁今天有空,再发两篇,然后就要忙自己的事情了。希望有网友能帮忙接下去,分享更多的经验。
准备工作:
安装在μSD上的debian系统
安装FTP工具 FileZilla

开始进入正题。
1.安装vsftpd
sudo apt-get install vsftpd
安装完毕后或许会自动生成一个帐户"ftp",然后去/srv/ftp下面新建一个共享文件夹share_ftp
修改用户及用户组为  ftp:ftp ,权限为所有都可读可写可执行。
sudo chown ftp:ftp /srv/ftp/share_ftp
sudo chmod 777  /srv/ftp/share_ftp


注意,如果想要新建一个ftp用户,那么就要用
adduser --home /srv/ftp/pub  ftp_zhao
然后别忘了输入密码。接着将pub 权限改为 ftp_zhao:ftp_zhao 777
sudo chmod 777  /srv/ftp/pub

最后,可以设置chroot_local_user=NO 将使用者限制在自己的家目录之内

还有一点,实践中发现ftp与anonymous 性质相似,都属于是匿名访问方式(都不需要密码).

修改ftp用户密码方法(可不改):
sudo passwd ftp

2.修改配置文件
通过sudo gedit /etc/vsftpd.conf修改。
  1. 完整配置代码如下(这是我自己的配置文件,可能会有不妥的地方,请仔细检查):

  2. # Example config file /etc/vsftpd.conf
  3. #
  4. # The default compiled in settings are fairly paranoid. This sample file
  5. # loosens things up a bit, to make the ftp daemon more usable.
  6. # Please see vsftpd.conf.5 for all compiled in defaults.
  7. #
  8. # READ THIS: This example file is NOT an exhaustive list of vsftpd options.
  9. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
  10. # capabilities.
  11. #
  12. #
  13. # Run standalone?  vsftpd can run either from an inetd or as a standalone
  14. # daemon started from an initscript.
  15. listen=YES
  16. #
  17. # Run standalone with IPv6?
  18. # Like the listen parameter, except vsftpd will listen on an IPv6 socket
  19. # instead of an IPv4 one. This parameter and the listen parameter are mutually
  20. # exclusive.
  21. #listen_ipv6=YES
  22. #
  23. # Allow anonymous FTP? (Disabled by default)
  24. anonymous_enable=YES
  25. #
  26. # Uncomment this to allow local users to log in.
  27. local_enable=YES
  28. #
  29. # Uncomment this to enable any form of FTP write command.
  30. write_enable=YES
  31. #
  32. # Default umask for local users is 077. You may wish to change this to 022,
  33. # if your users expect that (022 is used by most other ftpd's)
  34. local_umask=022
  35. #
  36. # Uncomment this to allow the anonymous FTP user to upload files. This only
  37. # has an effect if the above global write enable is activated. Also, you will
  38. # obviously need to create a directory writable by the FTP user.
  39. anon_upload_enable=YES
  40. #
  41. # Uncomment this if you want the anonymous FTP user to be able to create
  42. # new directories.
  43. anon_mkdir_write_enable=YES
  44. #
  45. # Activate directory messages - messages given to remote users when they
  46. # go into a certain directory.
  47. dirmessage_enable=YES
  48. #
  49. # If enabled, vsftpd will display directory listings with the time
  50. # in  your  local  time  zone.  The default is to display GMT. The
  51. # times returned by the MDTM FTP command are also affected by this
  52. # option.
  53. use_localtime=YES
  54. #
  55. # Activate logging of uploads/downloads.
  56. xferlog_enable=YES
  57. #
  58. # Make sure PORT transfer connections originate from port 20 (ftp-data).
  59. connect_from_port_20=YES
  60. #
  61. # If you want, you can arrange for uploaded anonymous files to be owned by
  62. # a different user. Note! Using "root" for uploaded files is not
  63. # recommended!
  64. chown_uploads=YES
  65. chown_username=ftp
  66. #
  67. # You may override where the log file goes if you like. The default is shown
  68. # below.
  69. #xferlog_file=/var/log/vsftpd.log
  70. #
  71. # If you want, you can have your log file in standard ftpd xferlog format.
  72. # Note that the default log file location is /var/log/xferlog in this case.
  73. xferlog_std_format=YES
  74. #
  75. # You may change the default value for timing out an idle session.
  76. #idle_session_timeout=600
  77. #
  78. # You may change the default value for timing out a data connection.
  79. #data_connection_timeout=120
  80. #
  81. # It is recommended that you define on your system a unique user which the
  82. # ftp server can use as a totally isolated and unprivileged user.
  83. #nopriv_user=ftpsecure
  84. #
  85. # Enable this and the server will recognise asynchronous ABOR requests. Not
  86. # recommended for security (the code is non-trivial). Not enabling it,
  87. # however, may confuse older FTP clients.
  88. #async_abor_enable=YES
  89. #
  90. # By default the server will pretend to allow ASCII mode but in fact ignore
  91. # the request. Turn on the below options to have the server actually do ASCII
  92. # mangling on files when in ASCII mode.
  93. # Beware that on some FTP servers, ASCII support allows a denial of service
  94. # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
  95. # predicted this attack and has always been safe, reporting the size of the
  96. # raw file.
  97. # ASCII mangling is a horrible feature of the protocol.
  98. ascii_upload_enable=YES
  99. ascii_download_enable=YES
  100. #
  101. # You may fully customise the login banner string:
  102. ftpd_banner=Welcome to blah Zhao's FTP service.
  103. #
  104. # You may specify a file of disallowed anonymous e-mail addresses. Apparently
  105. # useful for combatting certain DoS attacks.
  106. #deny_email_enable=YES
  107. # (default follows)
  108. #banned_email_file=/etc/vsftpd.banned_emails
  109. #
  110. # You may restrict local users to their home directories.  See the FAQ for
  111. # the possible risks in this before using chroot_local_user or
  112. # chroot_list_enable below.
  113. chroot_local_user=NO
  114. #
  115. # You may specify an explicit list of local users to chroot() to their home
  116. # directory. If chroot_local_user is YES, then this list becomes a list of
  117. # users to NOT chroot().
  118. #chroot_local_user=YES
  119. #chroot_list_enable=YES
  120. # (default follows)
  121. #chroot_list_file=/etc/vsftpd.chroot_list
  122. #
  123. # You may activate the "-R" option to the builtin ls. This is disabled by
  124. # default to avoid remote users being able to cause excessive I/O on large
  125. # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
  126. # the presence of the "-R" option, so there is a strong case for enabling it.
  127. #ls_recurse_enable=YES
  128. #
  129. # Debian customization
  130. #
  131. # Some of vsftpd's settings don't fit the Debian filesystem layout by
  132. # default.  These settings are more Debian-friendly.
  133. #
  134. # This option should be the name of a directory which is empty.  Also, the
  135. # directory should not be writable by the ftp user. This directory is used
  136. # as a secure chroot() jail at times vsftpd does not require filesystem
  137. # access.
  138. secure_chroot_dir=/var/run/vsftpd/empty
  139. #
  140. # This string is the name of the PAM service vsftpd will use.
  141. pam_service_name=vsftpd
  142. #
  143. # This option specifies the location of the RSA certificate to use for SSL
  144. # encrypted connections.
  145. rsa_cert_file=/etc/ssl/private/vsftpd.pem
复制代码
这样,在同局域网的电脑上,用我的IP地址,用帐号"ftp"和对应密码就可以登录了,密码是第一步里面passwd那句指定的。

对了,更改配置后不要忘了重启ftp服务  

命令:
sudo /etc/init.d/vsftpd restart

这样应该就没问题了。

打开FileZilla


FTP目录下空空的,从桌面拖一个new2.txt的文件进去试试。


是不是可以了呢?如果出现了,那就恭喜了。


如果需要用到匿名方式

这里选匿名即可。匿名用户可以上传下载就是不能修改,也不能跨目录,安全性比较好。

到这里,本文就算完成了。

[ 本帖最后由 lonerzf 于 2013-12-19 16:04 编辑 ]

最新回复

喜欢BBB,期待更多作品  详情 回复 发表于 2015-11-15 09:36

赞赏

1

查看全部赞赏

点赞 关注
 

回复
举报

1246

帖子

19

TA的资源

五彩晶圆(初级)

沙发
 
顶楼主的帖子!学习了!
个人签名
 
 

回复

75

帖子

1

TA的资源

一粒金砂(中级)

板凳
 
最近在试BBB与win或者Ubuntu互传文件   发现SSH挺好的  
 
 
 

回复

2721

帖子

0

TA的资源

纯净的硅(中级)

4
 
喜欢BBB,期待更多作品
 
 
 

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

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表