vsftpd FTP on Ubuntu Linux

vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast.
Using this instructions, you can set up vsftpd on variuos linux distros. This tutorial will show you how to set up your own ftp in Ubuntu Linux.

1. Install vsftpd

sudo apt-get install vsftpd

2. Change the configurations file
Open the vsftpd.conf configuration file with a text editor. The file is located in the /etc directory.

sudo joe /etc/vsftpd.conf

Once you are editing the file, you’ll want to make a few changes. Change this:

anonymous_enable=YES
local_umask=022

To this:

anonymous_enable=NO
local_umask=077

This will disallow anonymous access to your FTP server. Unless you have a really good reason for permitting anonymous access, and you know what you’re doing in terms of network security, I’d recommend leaving the anonymous access off. Especially if your Ubuntu FTP server is sitting on the Internet.

Of course, with anonymous access off, you’ll need to permit local users to log in. Do this by changing this directive:

#local_enable=YES

To this:

local_enable=YES

(Putting a # in front of a line disables it; this is called “commenting it out”.)

3. Adding a “fake” shell
Edit the /etc/shells file and add a non-existent shell name like /bin/false, for example. This fake shell will limit access on the system for FTP users.

sudo joe /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/false

/bin/false is our added no-existent shell. With Red Hat Linux, a special device name /dev/null exists for purposes such as these.

4. Setup an FTP user account
It’s important to give to your strictly FTP users no real shell account on the Linux system. In this manner, if for any reasons someone could successfully get out of the FTP chrooted environment, it would not have the possibility of executing any user tasks since it doesn’t have a bash shell. First, create new users for this purpose.
This has to be separate from a regular user account with unlimited access because of how the chroot environment works. Chroot makes it appear from the user’s perspective as if the level of the file system you’ve placed them in is the top level of the file system.
Use the following command to create users in the /etc/passwd file. This step must be done for each additional new user you allow to access your FTP server.

sudo mkdir -p /home/ftp/ftpuser
sudo useradd ftpuser -d /home/ftp/ftpuser/ -s /bin/false       添加这一步比较重要.没有添加完成不了哦
sudo passwd ftpuser

- The mkdir command will create the ftp/ftpuser directory under the /home directory to handle all FTP users’ home directories we’ll have on the server.
- The useradd command will add the new user named ftpuser to our Linux server.
- Finally, the passwd command will set the password for this user ftpuser.

Once you’ve made these changes, restart the vsftpd service with this command:

sudo /etc/init.d/vsftpd restart

5. Override config option specified in the manual page, on a per-user basis (optional)
If you want to make custom changes in the behaviour of the ftp server on a per-user basis, you should know that vsftpd has a powerful option that allows you to do this.
If you set user_config_dir to be /etc/vsftpd_user_conf and then log on as the user “chris”, then vsftpd will apply the settings in the file /etc/vsftpd_user_conf/chris for the duration of the session. The format of this file is detailed in the manual!
Please note that not all settings are effective on a per-user basis. For example, many settings only prior to the user’s session being started. Examples of settings which will not affect any behviour on a per-user basis include listen_addressbanner_filemax_per_ipmax_clientsxferlog_file, etc.

#vi /etc/pssswd

 

vsftpd:x:1006:1006::/home/vsftpd:/bin/false

tt:x:1007:1007::/var/ftp/upload:/bin/false

ftp:x:106:117:ftp daemon,,,:/srv/ftp:/bin/false

原创文章,转载请注明: 转载自PT Ubuntu Blog

本文链接地址: http://www.ptubuntu.com/2010/11/3948.html

Share

{ 发表评论? }

  1. 囧啊囧

    这个vsftpd搞的我纠结,我换了几个系统都没装上

    —————————–
    这几天在捣鼓VPS,比较纠结,博客都搬家了,等VPS搞定了再搬回来,研究需要点时间,过来告之一声。

  2. freetstar

    vsftpd乃ftp之利器阿

  3. 广州婚庆

    英文的不懂。。。

  4. ugg boots shops

    好难懂。。楼主搞计算机的?

  5. Linux爱好者

    这个主题在firefox 3.6.12下有问题,引用框超出post宽度了。

  6. coach bags on sale

    有机会研究看看,不过自己行动起来跟楼主肯定是有差距的。

  7. ugg boots shops

    博主很用心在整理啊。给你顶啦。

  8. 淘宝网店铺街

    看来都是 linux 操作语言啊!

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Verify Code   If you cannot see the CheckCode image,please refresh the page again!

Pingback & Trackback

  1. How to install wordpress theme - Wordpress 201 - Pingback on 2010/11/27/ 19:43
  2. How to Install Wordpress Into Your Site ? - Wordpress 201 - Pingback on 2010/11/29/ 01:49
  3. REVIEW IT BEFORE YOU BUY IT!!! - Trackback on 2011/01/17/ 13:52