1:useradd -d /home/zydc -s /sbin/nologin -m zydc
2:passwd zydc
3:usermod -G ems zydc( 出于 安全,不用配置,防止第三方用户可以登陆ams文件)
4:按照规范要求用ems用户,命令mkdir 创建目录:
[ems@EMSBAK zydc]$ mkdir GD
[ems@EMSBAK zydc]$ cd GD/
[ems@EMSBAK GD]$ mkdir WX
[ems@EMSBAK GD]$ ls
WX
[ems@EMSBAK GD]$ cd WX/
[ems@EMSBAK WX]$ ls
/home/zydc/GD/WX
5:chmod -R 777 /home/zydc
6:chown -R ems:ems /home/zydc(/home/zydc 是文件目录)
测试账户:
[root@EMS-CMJXA1 cnnbi]# ftp 10.239.34.68
Connected to 10.239.34.68 (10.239.34.68).
220 (vsFTPd 2.2.2)
Name (10.239.34.68:root): zydc
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
限制 zydc 用户,不能去其他目录,
第一步: 修改/etc/vsftpd/vsftpd.conf
将以下三行
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
改为
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
举例 :
[root@EMS log]# cd /etc/vsftpd/
[root@EMS vsftpd]# ls
ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh
[root@EMS vsftpd]# vi vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES