zoukankan      html  css  js  c++  java
  • [Ubuntu] vsftpd setup in Ubuntu

    1. install vsftpd, the version here is 2.3.5

    sudo apt-get install vsftpd

    2. create a user as a ftp account

    sudo mkdir /var/www/ftp
    useradd –s /sbin/nologin –d /var/www/ftp ftpuser
    passwd ftpuser
    sudo chown –R ftpuser:ftpuser /var/www/ftp

    3. modify the setting of vsftpd

    local_enable=YES
    write_enable=YES
    chroot_local_user=YES
    chroot_list_enable=YES
    chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
    local_root=/var/www/ftp

    4. after setting the configure of vsftpd, then use the ftp software to login.

    then, then you will get these error: 

    Status:    Connecting to 127.0.0.1:21...
    Status:    Connection established, waiting for welcome message...
    Response:    220 (vsFTPd 2.3.5)
    Command:    USER ftpuser
    Response:    331 Please specify the password.
    Command:    PASS ********
    Response:    530 Login incorrect.

    Why? i already set the correct username and password! 

    Then i google it, someone said that it seems that i forgot to add some code as: 

    pam_service_name=vsftpd

    but this setting exists by default of vsftpd!

    And i also check to /etc/pam.d, there is also vsftpd file in it. Why i still fail to login ftp?

    after minutes, as last i found out the solution.

    Please review the code of creating user of step 2 below:

    useradd –s /sbin/nologin –d /var/www/ftp ftpuser

    this command is to set the ftpuser who can NOT login via ssh or other way, but in /etc/shells,

    # /etc/shells: valid login shells
    /bin/sh
    /bin/dash
    /bin/bash
    /bin/rbash
    /usr/bin/tmux
    /usr/bin/screen

    it does NOT exist /usr/sbin/nologin !

    after adding the code /usr/sbin/nologin to /etc/shells, i resolved this problem! 

  • 相关阅读:
    iOS 谁说程序猿不懂浪漫之 爱心
    iOS 星星评价视图 3行搞定
    iOS 柱状图的定制
    iOS 跑马灯 一句话集成
    代理的使用
    发送的网络请求中含有中文 转码的实现
    杂记
    使用纯代码实现UICollectionView(UITableView)需要注册
    NSASSert的使用
    iOS进阶第三节 数据处理之CoreData
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/2834988.html
Copyright © 2011-2022 走看看