Linux_FTP服务器
目录
FTP
FTP(File Transfer Protocol文件传输协议),用于Internet上的控制文件的双向传输。同时,它也是一个Application。基于不同的操作系统有不同的FTP应用程序,而所有这些应用程序都遵守同一种FTP协议以传输文件。在FTP的使用当中,用户经常遇到两个概念:”下载”(Download)和”上传”(Upload)。”下载”文件就是从远程主机拷贝文件至自己的计算机上;”上传”文件就是将文件从自己的计算机中拷贝至远程主机上。用Internet语言来说,用户可通过FTPClient向(从)FTPServer上传(下载)文件。
FTP也是一个C/S架构。用户通过一个支持FTP协议的客户机程序,连接到在远程主机上的FTP服务器程序。用户通过客户机程序向服务器程序发出命令,服务器程序执行用户所发出的命令,并将执行的结果返回到客户机。比如说,用户发出一条命令,要求服务器向用户传送某一个文件的一份拷贝,服务器会响应这条命令,将指定文件送至用户的机器上。客户机程序代表用户接收到这个文件,将其存放在用户目录中。
TCP/IP协议中,FTP标准命令TCP端口号为21,Port方式数据端口为20。FTP的任务是从一台计算机将文件传送到另一台计算机,不受操作系统的限制。
FTPServer访问权限类型:匿名用户、虚拟用户、本地用户
FTP Server
FTPServer Support anonymous user,local user,Virtual user between share date.
Attention:But in the same computer, the virtual user and local user config can’t exist at the same time.
ServicePort:
a. TCP 21:Control commands transmission port.
b. TCP 20:Date transmission port.
Software:vsftpd
serviceName:vsftpd
User permission control file:
a. /etc/vsftpd/ftpuser –> deny login user,have higher priority
b. /etc/vsftpd/user_list –> only allow login user
FTP configuration
Global config
listen=YES #Use independent type to Listen into service
listen_address=ip #Assign listenIP
listen_port=21
ftp_date_port=20
write_enable=YES #whether upload
download_enable=YES #whether download
userlist_enable=YES #whether use user_list file
max_clients=0 #client connect conunt,0 measing is no limit.
pasv_enable=YES
pasv_min_port=portNumber #passivity(PASV) min float portNumber,FTPServer will proactive(PORT) use TCP20 port to connection client's PASV port(1025-65535).On the contrary, too.
pasv_max_poer=portNumber
data_connection_timeout=120 #connection timeout
Anonymous user FTP Config
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES #open anonymous login permissions
anon_umask=022 #anonymous user upload file's umask and anonymous user use ftp account to upload the file, use other account to download file. Anonymous user default support download file.
anon_root=/var/ftp #root directory after login --> the root directory cannot own 'rwx' permission and both owners and owning group are 'root'.
anon_upload_enable=YES #allow upload file
anon_mkdir_wirte_enable=YES #allow mkdir
anon_other_write_enable=YES #allow edit,delete,move the file
Attention:要实现匿名的下载,修改,删除,创建时,不可以修改FTP根目录的权限和属主,但是可以在根目录下创建AnonymousDir,并将其属主:属组修改为ftp:root,目录权限为757(出于安全的考虑)。
Virtual user FTP
step1. Create virtual user register DB file.
touch vuser.list
vim vuser.list
userName
userPasswd
step2. Convert the format of userDB file to Berkey DB.
db_load -T -t hash -f vuser.list vuser.db
chmod 600 vuser.*
step3. Create FTP root file also virtual user mapped as system user.
useradd -d /var/ftp/soft -s /sbin/nologin virtual
-d #specify virtual's homeDirectory
-S #specify virtual's shell
virtual #All virtual user will mapped as system user when they login.
虚拟用户上传时使用virtual用户的身份来进行,其宿主目录为/var/ftp/soft
chmod 755 /var/ftp/soft #Home directory permission decided what can the virtual user do in the FTP share home directory.
step4. Create PAM authentication file to support virtual user login.(PAM Pluggable authentication modules)
vim /etc/pam.d/vsftpd.vu
auth required pam.userdb.so db=/etc/vsftpd/vuser #identity authentication specify vuser.db file
account required pam.userdb.so db=/etc/vsftpd/vuser #identity verification
step5. Edit the vsftp.conf file
guest_enable=YES
guest_username=virtual #specify virtual user mapped system user
pam_service_name=vsftpd.vu #PAM authentication file,localUser's PAM is vsftpd. So localUser and virtualUser can't exist at the same time.
step6. Set the specific permission for virtualUser.
vim /etc/vsftpd/vsftpd.conf
user_config_dir=/etc/vsftpd/vusers_dir
mkdir /etc/vsftpd/vuser_dir
vim /etc/vsftpd/vuser_dir/deradm
anon_ipload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
local_eoor=/var/market #specify virtual user home directory.
Attention:If virtual user want to get the rwx permission in directory, we can set permission of 757 to the directory.Because the virtual user use the O(other)identity to access the directory.And we could be change the ownUser to ftp.
Local user FTP
Edit the config file
vim /etc/vsftpd/vsftpd.conf
local_enable=YES
local_root=/var/ftp
chroot_local_user=yes #localUser's home directory limit
chroot_list_enable=yes
chroot_list_file=/etc/vsftpd/chroot_list
Linux_FTP服务器的更多相关文章
- App开发:模拟服务器数据接口 - MockApi
为了方便app开发过程中,不受服务器接口的限制,便于客户端功能的快速测试,可以在客户端实现一个模拟服务器数据接口的MockApi模块.本篇文章就尝试为使用gradle的android项目设计实现Moc ...
- 闰秒导致MySQL服务器的CPU sys过高
今天,有个哥们碰到一个问题,他有一个从库,只要是启动MySQL,CPU使用率就非常高,其中sys占比也比较高,具体可见下图. 注意:他的生产环境是物理机,单个CPU,4个Core. 于是,他抓取了CP ...
- 闲来无聊,研究一下Web服务器 的源程序
web服务器是如何工作的 1989年的夏天,蒂姆.博纳斯-李开发了世界上第一个web服务器和web客户机.这个浏览器程序是一个简单的电话号码查询软件.最初的web服务器程序就是一个利用浏览器和web服 ...
- SignalR系列续集[系列8:SignalR的性能监测与服务器的负载测试]
目录 SignalR系列目录 前言 也是好久没写博客了,近期确实很忙,嗯..几个项目..头要炸..今天忙里偷闲.继续我们的小系列.. 先谢谢大家的支持.. 我们来聊聊SignalR的性能监测与服务器的 ...
- 使用 Nodejs 搭建简单的Web服务器
使用Nodejs搭建Web服务器是学习Node.js比较全面的入门教程,因为要完成一个简单的Web服务器,你需要学习Nodejs中几个比较重要的模块,比如:http协议模块.文件系统.url解析模块. ...
- 通过ProGet搭建一个内部的Nuget服务器
.NET Core项目完全使用Nuget 管理组件之间的依赖关系,Nuget已经成为.NET 生态系统中不可或缺的一个组件,从项目角度,将项目中各种组件的引用统统交给NuGet,添加组件/删除组件/以 ...
- 谈谈如何使用Netty开发实现高性能的RPC服务器
RPC(Remote Procedure Call Protocol)远程过程调用协议,它是一种通过网络,从远程计算机程序上请求服务,而不必了解底层网络技术的协议.说的再直白一点,就是客户端在不必知道 ...
- 游戏服务器菜鸟之C#初探一游戏服务
本人80后程序猿一枚,原来搞过C++/Java/C#,因为工作原因最后选择一直从事C#开发,因为读书时候对游戏一直比较感兴趣,机缘巧合公司做一个手游的项目,我就开始游戏服务器的折腾之旅. 游戏的构架是 ...
- 无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。如果服务器位于远程计算机上,请检查。。。
异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 无法向会话状态服务器发出会话状态请求.请确保 ASP.NET State Ser ...
随机推荐
- 二: Jvm内存模型
因为每个对象生命周期不一样,jvm在做内存管理的时候,就帮我们分成了三个区域: 1. 新生代(回收频率高) 新生和老年默认大小比例为1:2 2. 老年代(回收频率低) 最好所有的对象都 ...
- Rust学习笔记2
继续继续... 转眼都开学啦... Building Blocks 2 building blocks里讲了一些关于Log structure storage的东西,这也是用于在硬盘上持久化KvSto ...
- 原生ajax与伪ajax
原生ajax源码 function GetXHR(){ var xhr = null; if(XMLHttpRequest){ xhr = new XMLHttpRequest(); #如果没有XML ...
- oracle数据库ID自增长--序列
什么是序列?在mysql中有一个主键自动增长的id,例如:uid number primary key auto_increment;在oracle中序列就是类似于主键自动增长,两者功能是一样的,只是 ...
- 第二节,下载openwrt源码和编译环境
文章的开始先说两个重点 1.不要使用root用户编译,普通用户编译即可. 2.自行搭建梯子,以免编译失败. 一,进入虚拟机内的Ubuntu系统 点击左下角的显示应用程序,我们去修改一下Ubuntu的源 ...
- 《Java核心技术卷I》——第5章 继承
在C++中,没有提供用于表示抽象类的特殊关键字.只要有一个纯虚函数,这个类就是抽象类. hashCode()方法是定义在Object类中,因此每个对象都有一个默认的散列码,其值为对象的存储地址. 绝大 ...
- 007-流程控制 if 语句
流程控制 if 语句 if [ 条件判断式 ] ; then 程序 fi if [ 条件判断式 ] then 程序 fi 脚本示例: [root@zabbix lianxi]# .sh #!/bin/ ...
- 负载均衡的3种模型(httpd+lvs几十万并发的负载均衡搭建)
一.几种常见的负载均衡模型 二.搭建httpd+lvs LVS .node01 启动一块eth0:2的网卡子接口(ifconfig eth0: down可以把网卡down掉) ifconfig eth ...
- 6号板编译失败找不到arm-none-linux-gnueabi-gcc
明明已经添加到/etc/environment 安装sudo apt-get install lib32z1 lib32ncurses5
- 谷歌将用QUIC传输层技术加速互联网
安全这个话题,要感谢斯诺登,过去的安全就是攻和防之间的关系,即我们用一种什么样的体系.架构和模式去构建一个密不可破的安全系统.” 对IETF工作组忽视外部观察者看起来是一件甚么微不足道的事情的能力感到 ...