Ubuntu16.04 ftp服务器安装+配置

代码 代码 1275 人阅读 | 0 人回复

<
近来正在设置百度云效劳器战阿里云效劳器,需求把本地的代码战材料上传到效劳器,运转测试。
因而便需求本人拆建一个FTP效劳。
 
ftp效劳器装置取设置


  1. 1. ftp效劳真个装置
复造代码
假如之前设置过ftp效劳器的仍是以后设置的效劳器,没法启动效劳,那末底子是设置呈现了毛病,那末可先完整卸载后再停止装置。假如没法定位多数是镜像源的成绩,请改换阿里源。
  1. sudo apt-get update
  2. sudo apt-get install vsftpd
  3. vsftpd --version     //检测能否装置
复造代码
  1. 2. ftp效劳真个设置
复造代码
  1. vim /etc/vsftpd.conf    //编纂设置文件
复造代码
修正vsftpd.conf文件以下:
  1. listen=NO                 //能否开启监听ipv4战ipv6数据      
  2. listen_ipv6=YES          //能否开启监听ipv6数据
  3. # Allow anonymous FTP? (Disabled by default).
  4. anonymous_enable=NO      //能否许可藏名登岸,无需暗码
  5. # Uncomment this to allow local users to log in.
  6. local_enable=YES        //能否许可当地用户登录
  7. # Uncomment this to enable any form of FTP write command.
  8. write_enable=YES        //能否许可登岸者上传文件
  9. # Default umask for local users is 077. You may wish to change this to 022,
  10. # if your users expect that (022 is used by most other ftpd&#39;s)
  11. local_umask=022         //设置当地用户默许要加免的权限
  12. # Activate directory messages - messages given to remote users when they
  13. # go into a certain directory.
  14. dirmessage_enable=YES       //目次动静,可以给长途登岸的用户收收目次
  15. #
  16. # If enabled, vsftpd will display directory listings with the time
  17. # in  your  local  time  zone.  The default is to display GMT. The
  18. # times returned by the MDTM FTP command are also affected by this
  19. # option.
  20. use_localtime=YES           //效劳器所展现的目次将跟着当地工夫而改动
  21. #
  22. # Activate logging of uploads/downloads.
  23. xferlog_enable=YES          //开启上传下载的日记记载
  24. #
  25. # Make sure PORT transfer connections originate from port 20 (ftp-data).
  26. connect_from_port_20=YES    //确认毗连传输的端标语为20
  27. # You may override where the log file goes if you like. The default is shown
  28. # below.
  29. xferlog_file=/var/log/vsftpd.log    //日记文件寄存地位
  30. #
  31. # If you want, you can have your log file in standard ftpd xferlog format.
  32. # Note that the default log file location is /var/log/xferlog in this case.
  33. xferlog_std_format=YES          //日记文件接纳尺度格局
  34. # You may fully customise the login banner string:
  35. ftpd_banner=Welcome to FTP service.  //正在利用shell时登岸那末会收收欢送语
  36. # You may specify an explicit list of local users to chroot() to their home
  37. # directory. If chroot_local_user is YES, then this list becomes a list of
  38. # users to NOT chroot().
  39. # (Warning! chroot&#39;ing can be very dangerous. If using chroot, make sure that
  40. # the user does not have write access to the top level directory within the
  41. # chroot)
  42. chroot_local_user=YES        //对当地用户能否施行限定
  43. chroot_list_enable=YES       //开启限定利剑名单
  44. # (default follows)         
  45. chroot_list_file=/etc/vsftpd.chroot_list        //利剑名单途径,若无那个文件需求本人创立
  46. # This option should be the name of a directory which is empty.  Also, the
  47. # directory should not be writable by the ftp user. This directory is used
  48. # as a secure chroot() jail at times vsftpd does not require filesystem
  49. # access.
  50. secure_chroot_dir=/var/run/vsftpd/empty
  51. #
  52. # This string is the name of the PAM service vsftpd will use.
  53. # pam_service_name=vsftpd
  54. pam_service_name=ftp            //此处ubuntu的体系需求改成ftp
  55. # This option specifies the location of the RSA certificate to use for SSL
  56. # encrypted connections.
  57. rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
  58. rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
  59. ssl_enable=NO                 
  60. #
  61. # Uncomment this to indicate that vsftpd use a utf8 filesystem.
  62. utf8_filesystem=YES       //编码同一为utf8编码,能够辨认中文,避免治码
复造代码
  1. 3. vftpd设置完成
复造代码

增加设置ftpuser用户战会见目次


  1. 1. 创立ftp用户组战用户
复造代码
  1. sudo groupadd ftpusers //创立ftpusers用户组
  2. sudo useradd -m ftpuser_lxr//创立一个用户而且主动创立家目次为/home/ftpuser_lxr
  3. (第两种方法:mkdir /home/ftpuser_lxr //先创立家目次sudo userad -d /home/ftpuser_lxr ftpuser_lxr //绑定那个家目次)
  4. usermod -G ftpusers ftpuser_lxr //将那个新用户参加到ftpusers用户组中
  5. sudo passwd ftpuser_lxr   //变动暗码
  6. mkdir /home/ftpuser_lxr/ftp  //为用户增加一个具有必然权限的文件夹
  7. chmod 777 -R /home/ftpuser_lxr/ftp //新建一个pub目次用于寄存文件,而且付与局部权限
  8. usermod -s /sbin/nologin username  //限定用户登录方法;限定用户username只能经由过程ftp登岸,而不克不及间接登岸效劳器
复造代码
  1. 2.将该用户参加vsftpd.chroot_list利剑名单中
复造代码
  1. mkdir /etc/vsftpd.chroot_list
  2. vim vsftpd.chroot_list
复造代码
该文件内乱容以下:
  1. #利剑名单
  2. ftpuser_lxr
复造代码
  1. 3.开启并重启vsftpd的效劳
复造代码
systemctl start vsftpd大概service vsftpd start 
systemctl restart vsftpd大概service vsftpd restart

测试

办法一:
  1. 翻开阅读器,正在地点栏输进:ftp://ip_addresss
复造代码
办法两:
  1. 正在ubuntu中利用shell输进:ftp ip_address
复造代码
办法三:
  1. 正在windows中正在文件办理器地点栏输进:ftp://ip_addresss,该方法能够上传下载文件
复造代码
办法四:
  1. 正在windows中利用cmd输进:ftp://ip_addresss //显现毗连胜利
复造代码
 
 
 

免责声明:假如进犯了您的权益,请联络站少,我们会实时删除侵权内乱容,感谢协作!
1、本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,按照目前互联网开放的原则,我们将在不通知作者的情况下,转载文章;如果原文明确注明“禁止转载”,我们一定不会转载。如果我们转载的文章不符合作者的版权声明或者作者不想让我们转载您的文章的话,请您发送邮箱:Cdnjson@163.com提供相关证明,我们将积极配合您!
2、本网站转载文章仅为传播更多信息之目的,凡在本网站出现的信息,均仅供参考。本网站将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担责任。
3、任何透过本网站网页而链接及得到的资讯、产品及服务,本网站概不负责,亦不负任何法律责任。
4、本网站所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。
回复 关闭延时

使用道具 举报

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

本版积分规则