ubuntu 使用vsftpd 创建FTP服务(用户名密码登录,限制列出目录)
2018-02-10 12:11
537 查看
vsftpd介绍
ubuntu 安装 vsftpd
配置vsftpd
备份vsftpdconfig
编辑vsftpdconfig
创建登录用户
添加vsftpd 登录用户
添加vsftpd登录用户对目录树的权限
重启 vsftpd 服务
验证ftp服务
vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序。特点是小巧轻快,安全易用。
摘自百度百科-vsftpd
使用apt安装即可。
但是既然做了程序员就要懒一点,能自动就自动好了将配置好的文件与原始文件使用diff 生成的patch 文件,保存到本地,用patch命令更新即可。
懒得手动改,可以将上面的patch 文件保存到机器上,然后使用
这样就将配置更新了。
在/etc/vsftpd.user_list中添加允许登录ftp 的用户
ftpuser
在/etc/vsftpd.chroot_list 设置可列出、切换目录的用户
ftpuser
ubuntu 安装 vsftpd
配置vsftpd
备份vsftpdconfig
编辑vsftpdconfig
创建登录用户
添加vsftpd 登录用户
添加vsftpd登录用户对目录树的权限
重启 vsftpd 服务
验证ftp服务
vsftpd介绍
vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点。vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux、BSD、Solaris、 HP-UNIX等系统上面,是一个完全免费的、开放源代码的ftp服务器软件,支持很多其他的 FTP 服务器所不支持的特征。比如:非常高的安全性需求、带宽限制、良好的可伸缩性、可创建虚拟用户、支持IPv6、速率高等。vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序。特点是小巧轻快,安全易用。
摘自百度百科-vsftpd
ubuntu 安装 vsftpd
$ sudo apt-get install vsftpd
使用apt安装即可。
配置vsftpd
备份vsftpd.config
$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
编辑vsftpd.config
手动修改配置,根据下方的patch文件改一下。$ sudo vim /etc/vsftpd.config
但是既然做了程序员就要懒一点,能自动就自动好了将配置好的文件与原始文件使用diff 生成的patch 文件,保存到本地,用patch命令更新即可。
--- /etc/vsftpd.conf.orig 2018-02-08 13:39:05.983282023 +0800 +++ /etc/vsftpd.conf 2018-02-10 11:14:15.584088172 +0800 @@ -28,11 +28,11 @@ local_enable=YES # # Uncomment this to enable any form of FTP write command. -#write_enable=YES +write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) -#local_umask=022 +local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will @@ -67,11 +67,11 @@ # # You may override where the log file goes if you like. The default is shown # below. -#xferlog_file=/var/log/vsftpd.log +xferlog_file=/var/log/vsftpd.log # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. -#xferlog_std_format=YES +xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 @@ -100,7 +100,7 @@ #ascii_download_enable=YES # # You may fully customise the login banner string: -#ftpd_banner=Welcome to blah FTP service. +ftpd_banner=Welcome Lincoln Linux FTP Service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. @@ -120,9 +120,9 @@ # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES -#chroot_list_enable=YES +chroot_list_enable=YES # (default follows) -#chroot_list_file=/etc/vsftpd.chroot_list +chroot_list_file=/etc/vsftpd.chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large @@ -142,7 +142,7 @@ secure_chroot_dir=/var/run/vsftpd/empty # # This string is the name of the PAM service vsftpd will use. -pam_service_name=vsftpd +pam_service_name=ftp # # This option specifies the location of the RSA certificate to use for SSL # encrypted connections. @@ -152,4 +152,8 @@ # # Uncomment this to indicate that vsftpd use a utf8 filesystem. -#utf8_filesystem=YES +utf8_filesystem=YES +userlist_enable=YES +userlist_deny=NO +userlist_file=/etc/vsftpd.user_list +allow_writeable_chroot=YES
懒得手动改,可以将上面的patch 文件保存到机器上,然后使用
$ cd / $ sudo patch -p0 < [patch文件路径]
这样就将配置更新了。
创建登录用户
#先创建ftp目录 $ sudo mkdir /home/ftpdir #添加用户 $ sudo useradd -d /home/ftpdir -s /bin/bash ftpuser #设置用户密码 $ sudo passwd ftpuser #设置ftp目录用户权限 $ sudo chown ftpuser:ftpuser /home/ftpdir
添加vsftpd 登录用户
#新建文件/etc/vsftpd.user_list,用于存放允许访问ftp的用户: $ sudo touch /etc/vsftpd.user_list $ sudo vim /etc/vsftpd.user_list
在/etc/vsftpd.user_list中添加允许登录ftp 的用户
ftpuser
添加vsftpd登录用户对目录树的权限
#新建文件/etc/vsftpd.chroot_list,设置可列出、切换目录的用户: $ sudo touch /etc/vsftpd.chroot_list $ sudo vim /etc/vsftpd.chroot_list
在/etc/vsftpd.chroot_list 设置可列出、切换目录的用户
ftpuser
重启 vsftpd 服务
$ sudo service vsftpd restart
验证ftp服务
相关文章推荐
- ubuntu设置好samba服务器后,windows登录共享目录时出现“Samba服务器 解决不允许一个用户使用一个以上用户名与一个服务器或共享资源的多重连接”
- Ubuntu下安装FTP服务及使用(以VSFTPD为例)
- 【个人笔记重点,不作为参考】主题:ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- 配置Ubuntu安装vsftpd 只能访问默认目录 禁止用户登录SSH允许FTP Ubuntu 安装vsftpd 方法
- ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- Openstack使用官方ubuntu和Centos镜像无法使用ssh用户名密码登录登录的问题
- ubuntu输入密码登录后闪一下,无法进入系统 / ubuntu修改用户名、计算机名、主目录名 /改密码
- ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- Ubuntu下安装FTP服务及使用(VSFTPD详细设置)(二)
- ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录
- ubuntu 正确输入用户名和密码后重复登录界面(环境变量作祟)
- 如何使用FTP下载、上载文件和如何列出目录内容。
- vm6.5中 ubuntu10.10 环境变量设置错误 用户名与密码正确,无法登录
- ubuntu hadoop 环境创建ssh无密码登录 localhost
- ubuntu 正确输入 用户名和密码 后 重复登录界面
- ubuntu10.10输入了正确的用户名密码但是无法登录
- 易宝典文章——如何设定OWA登录时只使用用户名加密码的方式
- AS5 vsftpd限制登录用户访问目录(转)