问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

ubuntu服务器安装proftpd ftp服务器步骤

发布网友 发布时间:2023-10-12 15:03

我来回答

1个回答

热心网友 时间:2024-11-03 12:14

一、安装
复制代码
  
代码如下:
sudo apt-get install proftpd
安装过程中会让选择运行模式:Standalone和Inetd,前者是单一服务器模式,后者是超级服务器模式,
  我选的Standalone。
二、配置
复制代码
  
代码如下:
sudo vim /etc/shells
加入如下代码
复制代码
  
代码如下:
/bin/false
新建用户ftpuser1和用户组ftp并设置密码,此用户不需要有效的shell(更安全),所以选择/bin/false
  给fptuser1
复制代码
  
代码如下:
sudo groupadd ftp
  sudo useradd ftpuser1 -p pass -g ftp -d /home/ftp -s /bin/false
在/home/ftp目录下新建upload和download目录并修改权限
复制代码
  
代码如下:
cd /home/ftp
  sudo mkdir download
  sudo mkdir upload
  cd /home
  sudo chmod 755 ftp
  cd /home/ftp
  sudo chmod 755 download
  sudo chmod 777 upload
三、修改proftpd核心配置文件proftpd.conf
复制代码
  
代码如下:
sudo vim /etc/proftpd/proftpd.conf
  #
  # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
  # To really apply changes reload proftpd after modifications.
  #
  # Includes DSO moles
  Include /etc/proftpd/moles.conf
  # Set off to disable IPv6 support which is annoying on IPv4 only boxes.
  UseIPv6 off # 我们不需要IPv6,所以off
  ServerName "xiaoyigeng's FTP Server" # 修改服务器名
  ServerType standalone # 服务器运行模式,这里填standalone,也可以选
  inetd
  DeferWelcome on # 用户登陆时是否显示欢迎信息
  MultilineRFC2228 on
  DefaultServer on
  ShowSymlinks on
  TimeoutNoTransfer 600
  TimeoutStalled 600 # 可以降到100
  TimeoutIdle 1200 # 发呆超时
  DisplayLogin welcome.msg # 如果上边DeferWelcom设置成on,则显示
  welcome.msg中的内容
  DisplayFirstChdir .message # 更改目录时显示的内容
  ListOptions "-l"
  DenyFilter /*.*/
  # Use this to jail all users in their homes
  DefaultRoot /home/ftp # ftp用户被*在这个目录中
  # Users require a valid shell listed in /etc/shells to login.
  # Use this directive to release that constrain.
  # RequireValidShell off # 匿名用户要选on
  # Port 21 is the standard FTP port.
  Port 21 # 服务运行的端口
  # In some cases you have to specify passive ports range to by-pass
  # firewall limitations. Ephemeral ports can be used for that, but
  # feel free to use a more narrow range.
  # PassivePorts 49152 65534 # PASV模式下用到的端口
  # If your host was NATted, this option is useful in order to
  # allow passive tranfers to work. You have to use your public
  # address and opening the passive ports used on your firewall as well.
  # MasqueradeAddress 1.2.3.4
  # To prevent DoS attacks, set the maximum number of child processes
  # to 30. If you need to allow more than 30 concurrent connections
  # at once, simply increase this value. Note that this ONLY works
  # in standalone mode, in inetd mode you should use an inetd server
  # that allows you to limit maximum number of processes per service
  # (such as xinetd)
  MaxInstances 30
  # Set the user and group that the server normally runs at.
  User nobody # 服务器运行在nobody用户下
  Group nobody # 服务器运行在nobody组下
  # Umask 022 is a good standard umask to prevent new files and dirs
  # (second parm) from being group and world writable.
  Umask 022 022 # 默认新建文件的权限
  # Normally, we want files to be overwriteable.
  AllowOverwrite on # 文件可以被覆盖
  # Uncomment this if you are using NIS or LDAP to retrieve passwords:
  # PersistentPasswd off
  # Be warned: use of this directive impacts CPU average load!
  # Uncomment this if you like to see progress and transfer rate with ftpwho
  # in downloads. That is not needed for uploads rates.
  #
  # UseSendFile off
  # Choose a SQL backend among MySQL or PostgreSQL.
  # Both moles are loaded in default configuration, so you have to specify the backend
  # or comment out the unused mole in /etc/proftpd/moles.conf.
  # Use 'mysql' or 'postgres' as possible values.
  #
  #IfMole mod_sql.c
  # SQLBackend mysql
  #/IfMole
  TransferLog /var/log/proftpd/xferlog # 传送文件日志
  SystemLog /var/log/proftpd/proftpd.log # 系统运行日志
  IfMole mod_tls.c
  TLSEngine off
  /IfMole
  IfMole mod_quota.c
  QuotaEngine on
  /IfMole
  IfMole mod_ratio.c
  Ratios on
  /IfMole/pp# Delay engine reces impact of the so-called Timing Attack described in
  # a href="http://security.lss.hr/index.php?page=detailsID=LSS-2004-10-02"http://security.lss.hr/index.php?page=detailsID=LSS-2004-10-02/a
  # It is on by default.
  IfMole mod_delay.c
  DelayEngine on
  /IfMole
  IfMole mod_ctrls.c
  ControlsEngine on
  ControlsMaxClients 2
  ControlsLog /var/log/proftpd/controls.log
  ControlsInterval 5
  ControlsSocket /var/run/proftpd/proftpd.sock
  /IfMole
  IfMole mod_ctrls_admin.c
  AdminControlsEngine on
  /IfMole
  # A basic anonymous configuration, no upload directories.
  # Anonymous ~ftp
  # User ftp
  # Group nogroup
  # # We want clients to be able to login with "anonymous" as well as "ftp"
  # UserAlias anonymous ftp
  # # Cosmetic changes, all files belongs to ftp user
  # DirFakeUser on ftp
  # DirFakeGroup on ftp
  #
  # RequireValidShell off
  #
  # # Limit the maximum number of anonymous logins
  # MaxClients 10
  #
  # # We want 'welcome.msg' displayed at login, and '.message' displayed
  # # in each newly chdired directory.
  # DisplayLogin welcome.msg
  # DisplayFirstChdir .message
  #
  # # Limit WRITE everywhere in the anonymous chroot
  # Directory *
  # Limit WRITE
  # DenyAll
  # /Limit
  # /Directory
  #
  # # Uncomment this if you're brave.
  # # Directory incoming
  # # # Umask 022 is a good standard umask to prevent new files and dirs
  # # # (second parm) from being group and world writable.
  # # Umask 022 022
  # # Limit READ WRITE
  # # DenyAll
  # # /Limit
  # # Limit STOR
  # # AllowAll
  # # /Limit
  # # /Directory
  #
  # /Anonymous
  # Valid Logins # 以下部分为设置用户权限部分
  Limit LOGIN
  AllowUser ftpuser1
  DenyAll
  /Limit
  Directory /home/ftp
  Umask 022 022
  AllowOverwrite off
  Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD
  DenyAll
  /Limit
  /Directory
  Directory /home/ftp/download/
  Umask 022 022
  AllowOverwrite off
  Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD
  DenyAll
  /Limit
  /Directory
  Directory /home/ftp/upload/
  Umask 022 022
  AllowOverwrite on
  Limit READ RMD DELE
  DenyAll
  /Limit
  Limit STOR CWD MKD
  AllowAll
  /Limit
  /Directory
四、启动、停止、重启服务器
复制代码
  
代码如下:
sudo /etc/init.d/proftpd start
  sudo /etc/init.d/proftpd stop
  sudo /etc/init.d/proftpd restart
五、维护
可以到/var/log/proftpd目录查看日志
查看ftp服务器负载命令 ftptop
  查看什么认登陆服务器 ftpwho
PS:proftpd中Limit的使用介绍
我们用到的比较多的可能是Limit的使用,Limit大致有以下动作,基本能覆盖全部的权限了。
CMD:Change Working Directory 改变目录
  MKD:MaKe Directory 建立目录的权限
  RNFR: ReName FRom 更改目录名的权限
  DELE:DELEte 删除文件的权限
  RMD:ReMove Directory 删除目录的权限
  RETR:RETRieve 从服务端下载到客户端的权限
  STOR:STORe 从客户端上传到服务端的权限
  READ:可读的权限,不包括列目录的权限,相当于RETR,STAT等
  WRITE:写文件或者目录的权限,包括MKD和RMD
  DIRS:是否允许列目录,相当于LIST,NLST等权限,还是比较实用的
  ALL:所有权限
  LOGIN:是否允许登陆的权限
  针对上面这个Limit所应用的对象,又包括以下范围
  AllowUser 针对某个用户允许的Limit
  DenyUser 针对某个用户禁止的Limit
  AllowGroup 针对某个用户组允许的Limit
  DenyGroup 针对某个用户组禁止的Limit
  AllowAll 针对所有用户组允许的Limit
  DenyAll 针对所有用户禁止的Limit
关于*速率的参数为:
  TransferRate STOR|RETR 速度(Kbytes/s) user 使用者
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
ef英语哪个好 EF英孚英语培训怎么样? 英孚英语好不好 EF英孚教育到底好不好 大佬们,麦芒7和荣耀10那个值得入手?2500以下的机子还有啥好推荐的么... 介绍几款2500元以前的手机 像素一定要高 其他的不做要求 近期想入手一部安卓手机,价格2200到2500左右…买HTC desire Z还是 三星... 笔记本忘记开机密码怎么办急死了 笔记本电脑屏幕开机锁忘记密码 怎么办?急死了 华硕笔记本电脑开机密码忘记了怎样找回?系统是Windows 7旗舰版... 神念科技是哪里的公司 世界上开最快的车可以达到多少时速?13 世界上速度最快的车一小时多少公里?31 世界上最快的车是什么车?时速多少?289 世界上最快的跑车时速是多少?22 世界上最快的跑车时速是多少?22 世界上最快的列车时速能达到多少?5 目前世界上最快的网速是多少?25 华为手机怎么将下载的音乐添加的本地音乐282 用无人机私自拍摄违法吗1 为何在华为应用找不到华为手机助手?手机和电脑没法连接!1 为什么在华为手机应用市场app 里找不到华为手机助手?3 住房贷款70万30年3.2和4.1相差多少? 设置错了3 怎么设置 我设置了很多次都说参数错误 烦不烦209 X开头的单词有哪些呢? 无人机偷拍违法吗?3 ...不管你在做什么,我都会陪着你。用英语和德语来翻译。 PPTP,L2TP,IPSec和SSL 的区别 一步十寒的意思 ...企业合理协议是()备选答案:A PPTP B. L2TP C. IPSec D. SSL... PPTP,L2TP,IPSec和SSL 的区别 关于心动的歌曲和歌词2 "有多久没见你 有多远的距离"是哪首歌的歌词,原唱是谁?7 歌词里面有(一道光)的所以歌 女儿分手男朋友给女孩妈妈发道歉信球复合怎么回? 隧道协议PPTP,L2TP,IPSec和SSL的区别 怒、吼、脂、餐、划、晌、辣、渗、挣、埋、刷、测、详的形近字并... 隧道协议PPTP,L2TP,IPSec和SSL的区别 成语什么步十寒 隧道协议PPTP,L2TP,IPSec和SSL的区别 求老九门9-12资源,百度云或者360云盘都行 隧道协议PPTP,L2TP,IPSec和SSL的区别 神念凌天txt全集下载 使用的隧道协议可以有那几类,分别有哪些协议? 2020年7月毕业,没有找到工作,请问算是2021年的应届毕业生吗,可以报考... 230斤一个月可以瘦多少 如何建立个微信公众号,有360全景功能的,能实现三维立体看车看房?_百 ... 怎么用同一个手机号码申请多个, 求泰剧《真爱无价》(《人的价值》)主题曲 必须用心 音译歌词18