linux测试upnp,linux之文件传输协议(FTP)与本地用户测试

FTP:文件传输协议

两类连接:

命令连接:传输命令

数据连接:传输数据

端口号 TCP 20/21

工作方式:

主动模式:

21端口--控制端口

20端口--数据端口

描述:

当客户端与FTP服务器建立连接时客户端会输入账户和密码,当输入正确后,FTP服务器会用21端口返回给客户端一条登录成功的信息。客户端登录成功后会进行数据传输(连接成功后,客户端开始监听服务器20端口),此时客户端会产生一随机端口号通过FTP服务器21端口进行数据传输,当21端口收到数据流后会连接到FTP服务器20端口将相关数据流传输给客户端的随机端口,实现双方的数据传输。

被动模式:

21端口+随机端口

描述:

同样当客户机登录成功后,客户端会打开两个随机端口,第一个端口连接到FTP服务器21端口,此时客户端发送PASV命令,不允许FTP服务器21端口连接20端口,这样FTP服务器会使用随机端口号回应客户端PASV应答。此时客户端会使用第二个随机端口号来监听服务器传输来的数据。

路径映射:

用户家目录:每个用户的URL的/映射到当前用户的家目录

vsftpd以ftp用户的身份运行进程,默认认用户即为ftp用户,匿名用户的默认路径即ftp用户的家目录/var/ftp

程序环境:

主程序:/usr/sbin/vsftpd

主配置文件:/etc/vsftpd/vsftpd.conf

数据根目录:/var/ftp

系统模块文件:/usr/lib/systemd/system/vsftpd.service

配置vsftpd:

ftp用户:

匿名用户:

虚拟用户:非系统用户,用户账号非为可登陆操作系统的用户账号

系统用户:至少禁止系统用户访问ftp服务,/etc/vsftpd/ftpusers, PAM (/etc/pam.d/vsftpd)

用户通过vsftpd服务访问到默认路径,是用户自己的家目录;默认可以自己有权限访问的所有路径切换

配置文件:

/etc/vsftpd/vsftpd.conf

匿名用户:

anonymous_enablen=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

系统用户:

local_enable=YES

write_enable=YES

local_umask=022

辅助配置文件/etc/vsftpd/ftpusers

列在此文件中的用户 均禁止使用ftp服务

chroot_local_user=YES

本地用户在访问时只能访问自己的家目录

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

禁据列表中文件存在的用户于其家目录中 ;需要事先去除用户对家目录的写权限

传输日志:

xferlog_enable=YES

xferlog_file=/var/log/xferlog

xferlog_std_format=YES

守护进程的类型:

standalone :独立守护进程;由服务进程自行监听套按字.并接收用户访问请求

translent :瞬时守护进程;由受托管方代为监听套按字,服务进程没有访问请求时不启动;当托管方收到访问请求时才启动服务进程

Centos 6 : xinetd独立守护进程/etc/xinetd.d/

Centos 7 :由systemd代为监听

控制可登陆vsftpd服务的用户列表:

userlist_enable=YES

启用/etc/vsftpd/user_list文件来控制可登录用户

userlist_deny=

YES:意味着此为黑名单

NO:白名单

上传下载速率:

anon_max-rate=0

local_max_rate=0

并发连接数限制:

max_clients=2000

max_per_ip=50

测试:

配置本地用户上传和下载

(1)vsftpd可以直接使用Linux系统的本地用户作为FTP用户

使用本地用户登录FTP服务器后,默认将位于用户自己的主目录中,且具有读写权限

如利用qwertyuiop用户访问ftp,那么默认将进入到的目录是/home/qwertyuiop

创建系统用户,并设置密码,并在主目录中放置一个测试文件:

useradd  ftptest

passwd   vsftpdtest

echo ‘ftp test’ > /home/ftptest/ftptest.txt

创建系统用户test,并设置密码:

useradd  qwertyuiop

passwd   qwertyuiop

(2)允许用户ftptest登录,且登录成功后位于自己的家目录中。不允许qwertyuiop用户登陆

anonymous_enable=NO

local_enable=YES

write_enable=YES

chroot_local_user =YES

chroot_list_enable=NO

chroot_list_file=/etc/vsftpd/chroot_list

local_umask=022

userlist_enable=YES

userlist_deny=NO

将ftptest用户加入到 /etc/vsftpd/user_list文件。

(3)允许qwertyuiop用户登录,登录成功后位于/data目录,禁止ftptest用户登录

anonymous_enable=NO

local_enable=YES

write_enable=YES

chroot_local_user =YES

chroot_list_enable=NO

chroot_list_file=/etc/vsftpd/chroot_list

local_umask=022

userlist_enable=YES

userlist_deny=NO

local_root=/data

将qwertyuiop用户加入到 /etc/vsftpd/user_list文件。从此文件中删除ftptest用户

注:每次测试必须重新启动服务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
If you are experiencing problems with the Universal Plug and Play service, your computer might not be able to automatically detect the presence of other networked devices, such as PCs, printers, Internet access points and so on. That is where the UPnP Test application comes in. This simple program is designed to help you identify the issues that prevent the UPnP protocol from functioning correctly. Before you get your hopes up, you should know that this tool does not solve the detected problems, but only performs a series of tests to identify the possible causes. One advantage is that the application does not require installation, so your system registry is not affected in any way. The interface is compact and simple, comprising only two panels: one that displays the test type and its short description and the other for viewing which of the tests passed and which failed. The program can verify whether the operating system provides support for the UPnP service and allows you to check if the Simple Service Discovery Protocol (SSDP) and the UPnPHost services are running. It also verifies the connection between your network adapter and your router and the system's capacity to receive UPnP messages, as well as the router's capability to report an external IP address. One of the tests is designed to check if the Windows firewall service is blocking the traffic between your router and the system, thus preventing UPnP from working. The results can be copied to your clipboard by simply pressing a button and the tests can be redone easily. If you want to fix the detected issues, the link in the main interface can prove useful. In conclusion, UPnP Test is a simple tool for detecting problems related to device-to-device networking. However, it can only suggest possible reasons why the UPnP is not working, fixing the detected issues is totally up to you.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值