Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25773
  • 博文数量: 10
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-25 19:23
文章分类
文章存档

2014年(5)

2013年(5)

我的朋友

分类: LINUX

2014-01-05 11:14:36

原文地址:vsftpd配置、测试 作者:linux_kaige

#由于dpi项目目前阶段的需要,再配置个ftp用户,然后再写监控脚本,使用sendmail发送邮件通知。11:00 2012/1/31
  1. [root@admin ~]# useradd --help
  2. Usage: useradd [options] LOGIN
  3. Options:
  4. -b, --base-dir BASE_DIR base directory for the new user account
  5. home directory
  6. -c, --comment COMMENT set the GECOS field for the new user account
  7. -d, --home-dir HOME_DIR home directory for the new user account
  8. -D, --defaults print or save modified default useradd
  9. configuration
  10. -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
  11. -f, --inactive INACTIVE set password inactive after expiration
  12. to INACTIVE
  13. -g, --gid GROUP force use GROUP for the new user account
  14. -G, --groups GROUPS list of supplementary groups for the new
  15. user account
  16. -h, --help display this help message and exit
  17. -k, --skel SKEL_DIR specify an alternative skel directory
  18. -K, --key KEY=VALUE overrides /etc/login.defs defaults
  19. -m, --create-home create home directory for the new user
  20. account
  21. -l, do not add user to lastlog database file
  22. -M, do not create user's home directory(overrides /etc/login.defs)
  23. -r, create system account
  24. -o, --non-unique allow create user with duplicate
  25. (non-unique) UID
  26. -p, --password PASSWORD use encrypted password for the new user
  27. account
  28. -s, --shell SHELL the login shell for the new user account
  29. -u, --uid UID force use the UID for the new user account
  30. -Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping

  31. [root@admin ~]# usermod --help
  32. Usage: usermod [options] LOGIN

  33. Options:
  34.   -a, --append append the user to the supplemental GROUPS
  35. (use only with -G)
  36.   -c, --comment COMMENT new value of the GECOS field
  37.   -d, --home HOME_DIR new home directory for the user account
  38.   -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
  39.   -f, --inactive INACTIVE set password inactive after expiration
  40. to INACTIVE
  41.   -g, --gid GROUP force use GROUP as new primary group
  42.   -G, --groups GROUPS new list of supplementary GROUPS
  43.   -h, --help display this help message and exit
  44.   -l, --login NEW_LOGIN new value of the login name
  45.   -L, --lock lock the user account
  46.   -m, --move-home move contents of the home directory to the new
  47. location (use only with -d)
  48.   -o, --non-unique allow using duplicate (non-unique) UID
  49.   -p, --password PASSWORD use encrypted password for the new password
  50.   -s, --shell SHELL new login shell for the user account
  51.   -u, --uid UID new UID for the user account
  52.   -U, --unlock unlock the user account
  53.   -Z, --selinux-user new selinux user mapping for the user account
  54. [root@admin ~]# 
  55. [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用法
阅读(1122) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~