Ubuntu vsftpd安装设置文件不是件困难的事

系统 Linux
Ubuntu安装软件倒不是件困难的事,输入:sudo apt-get install Ubuntu vsftpd可能会提示你使用光盘,放进去再按回车就行了。安装了之后会在/home/下建立一个ftp目录。这时候你可以试着访问下ftp://IP地址。应该可以看到一个空白内容的ftp空间。默认设置下匿名用户可以下载,但不能写入或是上传。

Ubuntu vsftpd对于电脑使用的玩家的常用软件,然后我就学习及深入的研究Ubuntu vsftpd,在这里和大家一起探讨Ubuntu vsftpd的使用方法,希望对大家有用。Ubuntu vsftpd 和Proftp 安装与配置 ZT

1)安装Ubuntu vsftpd

Ubuntu安装软件倒不是件困难的事,输入:sudo apt-get install Ubuntu vsftpd可能会提示你使用光盘,放进去再按回车就行了。安装了之后会在/home/下建立一个ftp目录。这时候你可以试着访问下ftp://IP地址。应该可以看到一个空白内容的ftp空间。默认设置下匿名用户可以下载,但不能写入或是上传

2)设置 Ubuntu vsftpd.conf文件

现在我们要让匿名用户无法访问,并且得输入Linux上的用户密码后才能访问到他们自己目录里的内容。首先找到设置Ubuntu vsftpd的文件,位置在/etc/ vsftpd.conf修改之前***先备份下这个文件:sudo cp /etc/ vsftpd.conf /etc/ vsftpd.conf.old然后可以改动了:

  1. #不让匿名用户使用  
  2. #anonymous_enable=YES 
  3. #本地用户可用  
  4. local_enable=YES   
  5. #可用写操作  
  6. write_enable=YES 
  7. #不需要显示某目录下文件信息  
  8. #dirmessage_enable=YES   
  9. #加点banner提示  
  10. ftpd_banner=Hello~~   
  11. #FTP服务器***承载用户  
  12. max_clients=100 
  13. #限制每个IP的进程  
  14. max_per_ip=5 
  15. #***传输速率(b/s)  
  16. local_max_rate=256000 
  17. #隐藏帐号  
  18. hide_ids=YES  

好了,重启下ftp 服务器看看效果重启后还是和原来一样对吗?呵呵,这是默认的ftp目录在做鬼,我们把它删除,再看看。怎么样?要你输入用户名和密码了吧。

新的问题

1.输入用户名密码后显示的位置是在用户的根目录下,而我们的WEB内容是在public_html目录里

2.用户可以跳到任何其他目录(非常危险..)要解决这些问题我们还得设置下Ubuntu vsftpd.conf

  1. #启动chroot列表(Change root)  
  2. chroot_list_enable=YES 
  3. #指定列表位置(我这用的是默认地址)  
  4. chroot_list_file=/etc/Ubuntu vsftpd.chroot_list  
  5. 接下来我们得在Ubuntu vsftpd.chroot_list上写进去我们要限制哪些用户,不让他们“漂移”.. 

现在有用户linyupark,所以只要sudo nano一下,往里面写就行了这样我们已经解决第2个问题了,登陆的用户只能在它的用户文件夹里活动,下面我们要更狠一点,让他只能在public_html里活动依然还是找Ubuntu vsftpd.conf

#这句默认设置里是没有的,自己加user_config_dir=/etc/自己定义一个设置个别用户用的文件夹地址根据自己设置的地址,建立一个相应的文件夹,然后往里面建立和用户名相同的文件,nano一下:#本地用户的根地址,假设用户是linyuparklocal_root=/home/linyupark/public_html好咯,重启下服务器。

1- 使用下面的命令安装proftpd:

  1. Code:   
  2. sudo apt-get install proftpd  

2- 在etc/shells 加入如下代码 (sudo gedit /etc/shells to open the file)(译注:命令行模式下sudo vi /etc/shells) :

  1. Code:   
  2. /bin/false  

新建一个 /home/FTP-shared 目录 :

  1. Code:   
  2. cd /home   
  3. sudo mkdir FTP-shared  

创建一个只能用来读取ftp的用户userftp. 这个用户不需要有效的shell(更安全) ,所以选择 /bin/false shell 给 userftp , /home/FTP-shared 作为主目录。 为了是这部分更清楚,我给取此操作的命令行:

  1. Code:   
  2. sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false   
  3. 在FTP-shared 目录下新建一个download和一个upload 目录:   
  4. Code:   
  5. cd /home/FTP-shared/   
  6. sudo mkdir download   
  7. sudo mkdir upload  

现在我们来给它们设置相应的权限:

  1. Code:   
  2. cd /home   
  3. sudo chmod 755 FTP-shared   
  4. cd FTP-shared   
  5. sudo chmod 755 download   
  6. sudo chmod 777 upload  

3- 好了,现在进入proftpd的配置文件:

Code: sudo gedit /etc/proftpd/proftpd.conf //特别注意路径,网上以前给的是错的当然你可以按你的需要编辑你自己的proftpd.conf:

  1. Code:   
  2. # To really apply changes reload proftpd after modifications.   
  3. AllowOverwrite on   
  4. AuthAliasOnly on   
  5. # Choose here the user alias you want !!!!   
  6. UserAlias sauron userftp   
  7. ServerName "ChezFrodon"   
  8. ServerType standalone   
  9. DeferWelcome on   
  10. MultilineRFC2228 on   
  11. DefaultServer on   
  12. ShowSymlinks off   
  13. TimeoutNoTransfer 600   
  14. TimeoutStalled 100   
  15. TimeoutIdle 2200   
  16. DisplayFirstChdir .message   
  17. ListOptions "-l"   
  18. RequireValidShell off   
  19. TimeoutLogin 20   
  20. RootLogin off   
  21. # It''s better for debug to create log files ;-)   
  22. ExtendedLog /var/log/ftp.log   
  23. TransferLog /var/log/xferlog   
  24. SystemLog /var/log/syslog.log   
  25. #DenyFilter \*.*/  
  1. # I don''t choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me)   
  2. UseFtpUsers off   
  3. # Allow to restart a download   
  4. AllowStoreRestart on   
  5. # Port 21 is the standard FTP port, so don''t use it for security reasons (choose here the port you want)   
  6. Port 1980   
  7. # To prevent DoS attacks, set the maximum number of child processes   
  8. # to 30. If you need to allow more than 30 concurrent connections   
  9. # at once, simply increase this value. Note that this ONLY works   
  10. # in standalone mode, in inetd mode you should use an inetd server   
  11. # that allows you to limit maximum number of processes per service   
  12. # (such as xinetd)   
  13. MaxInstances 8   
  14. # Set the user and group that the server normally runs at.   
  15. User nobody   
  16. Group nogroup   
  17. # Umask 022 is a good standard umask to prevent new files and dirs   
  18. # (second parm) from being group and world writable.   
  19. Umask 022 022   
  20. PersistentPasswd off   
  21. MaxClients 8   
  22. MaxClientsPerHost 8   
  23. MaxClientsPerUser 8   
  24. MaxHostsPerUser 8   
  25. # Display a message after a successful login   
  26. AccessGrantMsg "welcome !!!"   
  27. # This message is displayed for each access good or not   
  28. ServerIdent on "you''re at home"   
  29. # Set /home/FTP-shared directory as home directory   
  30. DefaultRoot /home/FTP-shared   
  31. # Lock all the users in home directory, ***** really important *****   
  32. DefaultRoot ~   
  33. MaxLoginAttempts 5   
  34. #VALID LOGINS   
  35. AllowUser userftp   
  36. DenyALL   
  37. Umask 022 022   
  38. AllowOverwrite off   
  39. DenyAll   
  40. Umask 022 022   
  41. AllowOverwrite off   
  42. DenyAll   
  43. Umask 022 022   
  44. AllowOverwrite on   
  45. DenyAll   
  46. AllowAll  

好了,你已经完成了proftpd的配置,你的服务端口是1980,而读取的参数如下,用户:sauron,密码:你为userftp设置的那个。

4- 启动/停止/重启动你的服务:

  1. Code:   
  2. sudo /etc/init.d/proftpd start   
  3. sudo /etc/init.d/proftpd stop   
  4. sudo /etc/init.d/proftpd restart  

对你的proftpd进行一下语法检查:

  1. Code:   
  2. sudo proftpd -td5  

想知道谁现在连接到你的服务,用ftptop命令(使用字母"t"来转换显示频率),你也可以使用"ftpwho"命令。

【编辑推荐】

  1. Ubuntu IT在Linux中各种操作技术
  2. Ubuntu lighttpd安装和配置
  3. Ubuntu PHP测试环境中调试和分析代码
  4. Ubuntu Ruby在Rails应用程序中解决内存泄漏问题
  5. Ubuntu ruby解析器应用程序的优化
责任编辑:佚名 来源: csdn
相关推荐

2011-02-24 12:57:42

Ubuntuvsftpd安装

2010-01-13 15:53:11

CentOS vsft

2010-07-21 09:28:46

Ubuntu Linu

2010-03-05 16:20:38

Ubuntu中文环境

2010-02-22 15:04:53

Ubuntu 7.04

2013-05-07 09:23:59

Ubuntu 13.0

2011-10-08 18:10:14

Ubuntu 11.1

2011-03-09 14:02:55

LAMP安装设置

2011-04-27 09:22:44

Ubuntu 11.0

2020-05-08 11:08:24

Ubuntu 20.0Linux命令

2023-05-08 19:32:56

2011-02-23 10:11:10

ProFTPd安装

2013-10-31 13:31:19

Ubuntu 13.1

2017-10-22 16:01:25

Ubuntu系统浏览器

2013-11-08 10:42:31

Ubuntu 13.1

2022-10-28 08:37:03

UbuntuLinux

2011-02-23 14:38:39

安装CentOS vsftpd

2011-02-23 14:38:39

安装CentOS vsftpd

2011-03-02 15:12:11

2015-10-26 16:34:08

安装Ubuntu 15.1Linux
点赞
收藏

51CTO技术栈公众号