Ubuntu14.04 搭建vsftp服务器
来源:互联网 发布:红警3单位数据 编辑:程序博客网 时间:2024/05/16 01:41
因为要使用ftp服务,所以从网上找到这篇教程,很简单,后面可以使用sftp的服务。据说会安全一些?嗯..先摘到这里,有机会讨论一下安全性
FTP is used to transfer files from one host to another over TCP network. This article explains how to setup FTP server on ubuntu 14.04 .
There are 3 popular FTP server packages available PureFTPD, VsFTPD and ProFTPD. Here i’ve used VsFTPD which is lightweight and less Vulnerability.
Setup FTP server on Ubuntu 14.04
Step 1 » Update repositories .krizna@leela:~$ sudo apt-get update
Step 2 » Install VsFTPD package using the below command.krizna@leela:~$ sudo apt-get install vsftpd
Step 3 » After installation open /etc/vsftpd.conf file and make changes as follows.
Uncomment the below lines (line no:29 and 33).write_enable=YES
» Uncomment the below line (line no: 120 ) to prevent access to the other folders outside the Home directory.
local_umask=022chroot_local_user=YES
and add the following line at the end.allow_writeable_chroot=YES
» Add the following lines to enable passive mode.pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100
Step 4 » Restart vsftpd service using the below command.krizna@leela:~$ sudo service vsftpd restart
Step 5 » Now ftp server will listen on port 21. Create user with the below command.Use /usr/sbin/nologin shell to prevent access to the bash shell for the ftp users .krizna@leela:~$ sudo useradd -m john -s /usr/sbin/nologin
krizna@leela:~$ sudo passwd john
Step 6 » Allow login access for nologin shell . Open /etc/shells and add the following line at the end./usr/sbin/nologin
Now try to connect this ftp server with the username on port 21 using winscp orfilezilla client and make sure that user cannot access the other folders outside the home directory.
Please note using ftp on port 21 is a big security risk . it’s highly recommended to use SFTP. Please continue for SFTP configuration
Secure FTP ( SFTP )
SFTP is called as “Secure FTP” which generally use SSH File Transfer Protocol . so we need openssh-server package installed , Issue the below command if it’s not already installed.krizna@leela:~$ sudo apt-get install openssh-server
Step 7 » Create a new group ftpaccess for FTP users.krizna@leela:~$ sudo groupadd ftpaccess
Step 8 » Now make changes in this /etc/ssh/sshd_config file.
» Find and comment the below lineSubsystem sftp /usr/lib/openssh/sftp-server
and Add these lines at the end of the file.Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Step 9 » Restart sshd service.krizna@leela:~$ sudo service ssh restart
Step 10 » The below steps must be followed while creating Users for sftp access.
Create user john with ftpaccess group and /usr/bin/nologin shell.krizna@leela:~$ sudo useradd -m john -g ftpaccess -s /usr/sbin/nologin
Change ownership for the home directory.
krizna@leela:~$ sudo passwd johnkrizna@leela:~$ sudo chown root /home/john
Create a folder inside home directory for writing and change ownership of that folder.krizna@leela:~$ sudo mkdir /home/john/www
krizna@leela:~$ sudo chown john:ftpaccess /home/john/www
Now try to connect server using SFTP ( port : 22 ) and makesure Users can upload files to www directory and cannot access other folders outside home directory.
If you want use both FTP and SFTP together, please perform above steps ( Step 10 ) while creating users . For existing users, move them to ftpaccess group and create folder structure and ownership changes as below.krizna@leela:~$ sudo usermod john -g ftpaccess -s /usr/sbin/nologin
krizna@leela:~$ sudo chown root /home/john
krizna@leela:~$ sudo mkdir /home/john/www
krizna@leela:~$ sudo chown john:ftpaccess /home/john/www
Now john can able to upload files to www folder using FTP as well as SFTP.
使用Filezilla是可以连接成功的,如果需要关闭ftp服务,可以使用
sudo service vsftpd stop即可停止两个ftp
如果想只是使用一个sftp, 应该是略去vsftp中的step5即可。
- Ubuntu14.04 搭建vsftp服务器
- ubuntu搭建vsftp服务器
- Vsftp 服务器搭建
- vsftp 服务器搭建问题
- vsftp服务器的搭建
- ubuntu14.04 nfs服务器搭建
- 搭建webrtc服务器(ubuntu14.04)
- 搭建webrtc服务器(ubuntu14.04)
- centos搭建配置vsftp服务器
- Ubuntu 16.04 VSFTP服务器搭建
- Ubuntu 16.04 VSFTP服务器搭建
- Ubuntu 16.04 VSFTP服务器搭建
- Linux Ubuntu搭建vsftp服务器
- SVN服务器搭建02---SVN服务器软件搭建(Ubuntu14.04)
- ubuntu14.04 下的tftp服务器搭建
- ubuntu14.04sendmail搭建邮件服务器
- Ubuntu14.04下搭建Boa web服务器
- Ubuntu14.04下搭建git服务器
- poj 1325 Machine Schedule(最大匹配,匈牙利算法)
- 应用dts在am335x上移植LCD(一)
- 同时启动多个 tomcat 服务
- 【OC语法】Foundation框架-NSObject
- iOS关于SQLite数据库的操作(使用第三方类库FMDB)
- Ubuntu14.04 搭建vsftp服务器
- GoLang Channel与mutex的选择,性能差不多
- egit提交代码到远程仓库
- simhash算法原理及实现
- 使用MyBatis的ScriptRunner执行sql文件
- 太阳系模型小项目(JAVA)
- SSH:Spring框架(简介)
- python装饰器decorator之计算函数运行时间的例子
- 实习整理(九)