测试linux vsftpd,vsftpd配置、测试

这篇博客详细记录了在Linux系统中配置FTP服务器,包括创建FTP用户、设置权限和监控脚本,并使用sendmail发送邮件通知的过程。还涉及到vsftpd.conf配置文件的修改,确保用户只能访问特定目录,并通过chmod命令调整权限。最后,通过FTP客户端进行测试,确认配置成功。
摘要由CSDN通过智能技术生成

#由于dpi项目目前阶段的需要,再配置个ftp用户,然后再写监控脚本,使用sendmail发送邮件通知。11:00 2012/1/31

[root@admin ~]# useradd --help

Usage: useradd [options] LOGIN

Options:

-b, --base-dir BASE_DIRbase directory for the new user account

home directory

-c, --comment COMMENTset the GECOS field for the new user account

-d, --home-dir HOME_DIRhome directory for the new user account

-D, --defaultsprint or save modified default useradd

configuration

-e, --expiredate EXPIRE_DATEset account expiration date to EXPIRE_DATE

-f, --inactive INACTIVEset password inactive after expiration

to INACTIVE

-g, --gid GROUPforce use GROUP for the new user account

-G, --groups GROUPSlist of supplementary groups for the new

user account

-h, --helpdisplay this help message and exit

-k, --skel SKEL_DIRspecify an alternative skel directory

-K, --key KEY=VALUEoverrides /etc/login.defs defaults

-m, --create-homecreate home directory for the new user

account

-l, do not add user to lastlog database file

-M, do not create user's home directory(overrides /etc/login.defs)

-r, create system account

-o, --non-uniqueallow create user with duplicate

(non-unique) UID

-p, --password PASSWORDuse encrypted password for the new user

account

-s, --shell SHELLthe login shell for the new user account

-u, --uid UID force use the UID for the new user account

-Z, --selinux-user SEUSERuse a specific SEUSER for the SELinux user mapping

[root@admin ~]# usermod --help

Usage: usermod [options] LOGIN

Options:

-a, --appendappend the user to the supplemental GROUPS

(use only with -G)

-c, --comment COMMENTnew value of the GECOS field

-d, --home HOME_DIRnew home directory for the user account

-e, --expiredate EXPIRE_DATEset account expiration date to EXPIRE_DATE

-f, --inactive INACTIVEset password inactive after expiration

to INACTIVE

-g, --gid GROUPforce use GROUP as new primary group

-G, --groups GROUPSnew list of supplementary GROUPS

-h, --helpdisplay this help message and exit

-l, --login NEW_LOGINnew value of the login name

-L, --locklock the user account

-m, --move-homemove contents of the home directory to the new

location (use only with -d)

-o, --non-uniqueallow using duplicate (non-unique) UID

-p, --password PASSWORDuse encrypted password for the new password

-s, --shell SHELLnew login shell for the user account

-u, --uid UIDnew UID for the user account

-U, --unlockunlock the user account

-Z, --selinux-usernew selinux user mapping for the user account

[root@admin ~]#

[root@admin ~]# useradd -g ftp -M -s /sbin/nologin -d /yk/changshang/royal/ -l royal

[root@admin ~]# useradd  -g ftp -d /yk/dpipaiqi -s /sbin/nologin paiqibiao

[root@admin ~]# passwd paiqibiao

Changing password for user paiqibiao.

New UNIX password:

BAD PASSWORD: it is too simplistic/systematic

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@admin ~]#

#修改/etc/vsftpd/vsftpd.conf,设置chroot,anonymous,userlist。

[root@admin vsftpd]# service vsftpd restart

关闭 vsftpd:                                              [确定]

为 vsftpd 启动 vsftpd:                                    [确定]

[root@admin vsftpd]#

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>ftp 61.*.***.132

连接到 61.*.***.132。

220 (vsFTPd 2.0.5)

用户(61.*.***.132:(none)): paiqibiao

331 Please specify the password.

密码:

500 OOPS: cannot change directory:/yk/dpipaiqi

500 OOPS: child died

远程主机关闭连接。

[root@admin /]# ll |grep yk

drwx------   7 yangkai root  4096 01-31 10:35 yk

[root@admin /]# chmod +x yk/

[root@admin /]# ll |grep yk

drwx--x--x   7 yangkai root  4096 01-31 10:35 yk

[root@admin /]#

C:\Users\Administrator>ftp 61.*.***.132

连接到 61.*.***.132。

220 (vsFTPd 2.0.5)

用户(61.*.***..132:(none)): paiqibiao

331 Please specify the password.

密码:

230 Login successful.

ftp> ls

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

226 Directory send OK.

ftp> dir

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

226 Directory send OK.

[root@admin ~]# cp /etc/vsftpd/vsftpd.conf /yk/dpipaiqi/

ftp> ls

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

vsftpd.conf

226 Directory send OK.

ftp: 收到 13 字节,用时 0.00秒 13.00千字节/秒。

ftp> get vsftpd.conf

200 PORT command successful. Consider using PASV.

550 Failed to open file.

[root@admin ~]# chmod 777 /yk/dpipaiqi/vsftpd.conf

ftp> get vsftpd.conf

200 PORT command successful. Consider using PASV.

150 Opening BINARY mode data connection for vsftpd.conf (4648 bytes).

226 File send OK.

ftp: 收到 4648 字节,用时 0.00秒 4648.00千字节/秒。

ftp>

[root@admin ~]# cd /yk/dpipaiqi/vsftpd.conf

-bash: cd: /yk/dpipaiqi/vsftpd.conf: 不是目录

[root@admin ~]# cd /yk/dpipaiqi/

[root@admin dpipaiqi]# mv vsftpd.conf vsftpd.conf.bak

[root@admin /]# echo $LANG

zh_CN.UTF-8

[root@admin /]#

ftp> put vsftpd.conf

200 PORT command successful. Consider using PASV.

150 Ok to send data.

226 File receive OK.

ftp: 发送 4648 字节,用时 0.02秒 193.67千字节/秒。

ftp>

ftp> ls

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

vsftpd.conf

vsftpd.conf.bak

226 Directory send OK.

ftp: 收到 30 字节,用时 0.00秒 30.00千字节/秒。

ftp> cd ..

250 Directory successfully changed.

ftp> dir

200 PORT command successful. Consider using PASV.

150 Here comes the directory listing.

-rw-r--r--    1 507      50           4648 Jan 31 02:44 vsftpd.conf

-rwxrwxrwx    1 0        0            4648 Jan 31 02:42 vsftpd.conf.bak

226 Directory send OK.

ftp: 收到 142 字节,用时 0.00秒 71.00千字节/秒。

ftp> quit

221 Goodbye.

C:\Users\Administrator>

#ok,测试完成,配置结束。

----------------------------------------------------------------------------------------------

find用法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值