好好爱自己!

在Ubuntu 14.04 上安装 FTP 服务

 

  1. sudo apt-get update

  2. sudo apt-get install vsftpd

  3. adduser sammy

Assign a password when prompted and feel free to press "ENTER" through the other prompts.

FTP is generally more secure when users are restricted to a specific directory.vsftpd accomplishes this with chroot jails. When chroot is enabled for local users, they are restricted to their home directory by default. However, because of the way vsftpd secures the directory, it must not be writable by the user. This is fine for a new user who should only connect via FTP, but an existing user may need to write to their home folder if they also shell access.

In this example, rather than removing write privileges from the home directory, we're will create an ftpdirectory to serve as the chroot and a writable files directory to hold the actual files.

Create the ftp folder, set its ownership, and be sure to remove write permissions with the following commands:

  • sudo mkdir /home/sammy/ftp
  • sudo chown nobody:nogroup /home/sammy/ftp
  • sudo chmod a-w /home/sammy/ftp

除了途中两处外,还有一处: ,   不加这句的话,在ftp客户端不能重命名文件或文件夹。

 

重启vsftpd   service vsftpd restart

 

 

 

 

在Ubuntu 14.04 上安装 FTP 服务

第一步>>更新库

linuxidc@linuxidc:~$ sudo apt-get update

第二步>>采用如下命令安装VSFTPD的包

linuxidc@linuxidc:~$ sudo apt-get install vsftpd

第三步>>安装完成后打开 /etc/vsftpd.conf 文件,按如下所述修改。

取消如下行的注释(行号为29和33)

write_enable=YES
local_umask=022

>> 取消如下行的注释(行号120)来阻止除了用户文件夹意外的文件夹。

chroot_local_user=YES

在文件最后增加如下一行:

allow_writeable_chroot=YES

posted @ 2017-08-07 16:49  立志做一个好的程序员  阅读(277)  评论(0编辑  收藏  举报

不断学习创作,与自己快乐相处