Ubuntu ftp server Construction

Source: Internet
Author: User

I. Use the sftp-server provided by openssh

Data can be encrypted and transmitted using sftp. After openssh-server is enabled, sftp-server is enabled by default.

Configuration file/etc/ssh/sshd_config

Modify: Cancel comments.

# Subsystem sftp/usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp

Add:

Match User username  X11Forwarding no  AllowTcpForwarding no  ForceCommand internal-sftp  ChrootDirectory /home/sftp

See https://wiki.archlinux.org/index.php/SFTP_chroot

Ii. Install vsftp in Ubuntu/Debian

1. Update the software source

First you need to update the system software source, convenient tool: http://help.aliyun.com/manual? Spm = 0.0.0.0.zJ3dBU & helpId = 1692

2. Install vsftp

Use the apt-get command to install vsftp

# Apt-get install vsftpd-y

3. Add an ftp account and Directory

First check the location of nologin, usually under/usr/sbin/nologin or/sbin/nologin.

Use the following command to create an account. The command specifies/alidata/www/wwwroot as the Home Directory of user pwftp. You can define the account name and directory by yourself:

# Useradd-d/alidata/www/wwwroot-s/sbin/nologin pwftp

Modify the account password:

# Passwd pwftp

Modify the permission of a specified directory

# Chown-R pwftp. pwftp/alidata/www/wwwroot

4. Configure vsftp

To edit the vsftp configuration file, run the following command:

# Vi/etc/vsftpd. conf

Change "anonymous_enable = YES" in the configuration file to "anonymous_enable = NO"

Cancel the annotator before the following Configuration:

Local_enable = YES

Write_enable = YES

Chroot_local_user = YES

Chroot_list_enable = YES

Chroot_list_file =/etc/vsftpd. chroot_list

Save and exit

Edit the/etc/vsftpd. chroot_list file, add the ftp account name, save and exit.

5. Modify shell configuration

Vi edit/etc/shells. If the file does not contain/usr/sbin/nologin or/sbin/nologin (depending on the current system configuration), append it

6. Restart the vsftp service and test logon.

Run the following command to start the vsftp service:

# Service vsftpd restart

Then, use the account pwftp to test whether ftp can be logged on. The directory is/alidata/www/wwwroot.

Refer:

Http://blog.csdn.net/jimyjimang/article/details/7454617

Http://yhf8377.blog.163.com/blog/static/176860177201210217219800/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.