Setup FTP server on Ubuntu 14.04

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
local_umask=022
» Uncomment the below line (line no: 120 ) to prevent access to the other folders outside the Home directory.
chroot_local_user=YESand 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 or filezilla client and make sure that user cannot access the other folders outside the home directory.
setup FTP server ubuntu 14.04
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 line
Subsystem sftp /usr/lib/openssh/sftp-serverand 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
krizna@leela:~$ sudo passwd john
Change ownership for the home directory.
krizna@leela:~$ sudo chown root /home/johnCreate 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 wwwdirectory and cannot access other folders outside home directory.setup FTP server ubuntu 14.04
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.

转载于:https://www.cnblogs.com/xiaojikuaipao/p/6677644.html

一、Server-U的安装 1、安装Server-U英文版 在Server-U安装文件所在目录,执行安装文件(ServUSetup.exe),出现以下界面,根据屏幕提示直至安装完成(安装完成后,在系统托盘上,将出现Server-U的小图标)。 2、Server-U英文版的汉化 1)先结束Server-U的守护进程 在系统托盘中Server-U的小图标上按右键,选择退出 2)安装汉化包 执行汉化包目录下的汉化文件(注意不要装上网助手)。 3、Server-U的注册 1) 先复制注册文件到Server-U的安装目录(可能为D:\Program files\Serv-U) 2)执行该注册文件 二、Server-U的配置和管理 1、启动Server-U 依次但击 [开始菜单/Serv-U FTP Server/Tray Monitor], 执行后在系统托盘上,将出现Server-U的小图标 2、启动Server-U管理员程序 在系统托盘中Server-U的小图标上按右键,选择[启动管理员] 启动后可能会出现配置向导,单击[取消]按钮取消 3、新建域 新建一个名为JSJX的域(域IP地址不用指定,域名输入JSJX,其他默认值即可) 4、新建用户 新建匿名用户,用户名为:anonymous, 没有密码,主目录可设为F:\FTPROOT 注意,匿名用户名必须为anonymous,匿名用户在登陆时不必输用户名和密码,匿 名一般只具有浏览和下载权限 新建一个名为ftpadmin的用户,密码与用户名相同,主目录也可设为F:\FTPROOT 此用户将来可给予较多的权限 说明:主目录也可根据需要设,但最好设为F:\FTPROOT,将来只要把其他目录映 射为该目录下的虚拟目录即可。 4、设置用户权限 选中一个用户,点击右边的[目录访问]卡片,再在下面的目录列表框中,选择一个目录,可设置该用户对该目录的访问权限,用户可以对不同目录拥有不同权限。注意:设置完成后请单击 [应用]按钮 使设置生效 5、虚拟目录设置 设置虚拟目录需要经过以下两个步骤来完成 1)在[JSJX域]中单击[设置],在右边选中[常规]卡片,再单击[添加]按钮,按提 示完成设置操作,设置完成后的结果如下图所示: 2)选中一个用户,单击右下的[添加]按钮,添加要映射的目录,如下图所示: 6、其它设置 下面的设置,请自己思考如何完成  最大上传/下载速度的设置  同时连接的最大用户数设置  磁盘配额的设置  消息设置  端口号设置  IP访问规则设置  超时连接时间设置 六、在客户机上安装LeapFTP 1、安装LeapFTP 2、注册 七、访问FTP服务器 1、使用匿名用户下载 2、使用ftpadmin上传和下载 八、使用LeapFTP往Web站点上传网页和从Web站点下载网页 把WWW服务器的主目录映射为FTP服务器的一个虚拟目录,即可在远离WWWW服务器的地方维护WWW服务器上的网页。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值