如何在ubuntu18.04系统搭建ftp
在ubuntu 18.04系统上搭建ftp服务器,可以使用vsftpd这个软件,以下是详细的步骤:
1、更新系统软件包列表
sudo apt update
2、安装vsftpd软件
sudo apt install vsftpd
3、配置vsftpd服务
编辑vsftpd的配置文件:
sudo nano /etc/vsftpd.conf
在配置文件中,可以进行以下设置:
参数 | 说明 | 默认值 |
anonymous_enable | 是否允许匿名访问 | no |
local_enable | 是否允许本地用户访问 | yes |
write_enable | 是否允许写入操作 | no |
local_umask | 本地用户上传文件的权限掩码 | 022 |
anon_upload_enable | 是否允许匿名用户上传文件 | no |
anon_mkdir_write_enable | 是否允许匿名用户创建目录和写入文件 | no |
anon_other_write_enable | 是否允许匿名用户执行其他写入操作 | no |
local_root | 本地用户的根目录 | /home/用户名 |
chroot_local_user | 是否限制本地用户只能访问其主目录 | no |
allow_writeable_chroot | 是否允许chroot的目录具有写权限 | no |
listen | vsftpd监听的ip地址和端口 | 0.0.0.0:21 |
pasv_min_port | pasv模式使用的最小端口号 | 40000 |
pasv_max_port | pasv模式使用的最大端口号 | 50000 |
pasv_address | pasv模式监听的ip地址和端口范围 | *:40000,*:50000 |
passive_mode | 是否启用pasv模式 | no |
userlist_enable | 是否启用用户列表文件限制访问 | no |
userlist_deny | 禁止访问的用户列表文件名 | /etc/vsftpd.userlist |
userlist_file | 允许访问的用户列表文件名 | /etc/vsftpd.userlist |
xferlog_enable | 是否启用传输日志记录功能 | no |
xferlog_file | 传输日志文件路径和名称 | /var/log/vsftpd.log |
connect_from_port_20 | 是否允许从非控制连接端口(例如port或pasv)连接到数据端口(例如20)的连接请求,这可以防止拒绝服务攻击,如果禁用此选项,则必须将数据端口更改为非标准端口,默认值为yes。 | no |
| disable_transport = tls, tlsv1, tlsv1.1, tlsv1.2, sslv3, sslv2, sshv1, sshv2, sftp, scp, rsh, rlogin, local, none, protocol=983, certs=/etc/ssl/certs/cacertificates.crt, cafile=/etc/ssl/certs/cacertificates.crt, password=yourpassword, ipv6=yes, ipv4=yes, ipv6protocol=auto, ipv4protocol=auto, force_ipv4=yes, force_ipv6=yes, xcrypto=yes, xshadow=yes, xauth=no, xauthzone=no, xsock=yes, xdebug=no, xlogging=no, xlocaledir=/usr/share/locale, lang=en_us.utf8, locpath=/usr/local/lib/locale:/usr/share/locale:/var/lib/locales:/var/lib/locales:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share/locale:~/.local/share//zoneinfo:~/.local//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo:~//zoneinfo: ~ // zone info l en_us.utf8 xutf8 futf8 iso646 ofilename=myhostname dmydomainname hstrangehostname imyipaddress s443 bw1024 tc r n k e q z a p mypassword l log_level=info m filesizelimit=1gb f filetype=logical y forcedotfiles=yes z forcedotfiles=yes b forcedotfiles=yes d forcedotfiles=yes l forcedotfiles=yes n forcedotfiles=yes o forcedotfiles=yes q forcedotfiles=yes r forcedotfiles=yes s forcedotfiles=yes t forcedotfiles=yes u forcedotfiles=yes v forcedotfiles=yes w forcedotfiles=yes x forcedotfiles=yes y forcedotfiles=yes z forcedotfiles=yes b forcedotfiles=yes d forcedotfiles=yes l forcedotfiles=yes n forcedotfiles=yes o forcedotfiles=yes q forcedotfiles=yes r forcedotfiles=yes s forcedotfiles=yes t forcedinies=no u forcedinies=no v forcedinies=no w forcedinies=no x forcedinies=no y forcedinies=no z forcedinies=no b forcedinies=no d forcedinies=no l forcedinies=no n forcedinies=no o forcedinies=no q forcedinies=no r forcedinies=no s forcedinies=no t enablesyslog = no" "pasv_promiscuous = yes" "listen = all" "passive_ports = 4000050000" "ssl_enable = yes" "allow_anon_ssl = yes" "force_local_data_ssl = yes" "force_local_logins_ssl = yes" "ssl_tlsv1 = yes" "ssl_sslv2 = yes" "ssl_sslv3 = yes" "require_ssl_reuse = yes" "ssl_ciphers = ecdhersaaes128gcmsha256:ecdheecdsaaes128gcmsha256:" "ssl_prefer_server_ciphers = yes" "ssl_ecdh_curve = prime256v1" "ssl_dhparam = /etc/ssl/certs/*dhparams" "ssl_sessioncache = yes" "ssl_sessiontimeout = 3600" "ssl_sessiontickets = yes" "userlist_enable = yes" "userlist = user1,user2" "userlist_deny = nobody" "allow_writeable_chroot = yes" "chroot_local_user = yes" "listen = all" "listen [::]:all" "pasv_min_port = 40000" "pasv_max_port =