vsftpd

vsftpd config

$ sudo apt-get install vsftpd
$ sudo vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
chroot_list_enable=YES            // unusefully ?
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list  // unusefully ?
// create new file: /etc/vsftpd.chroot_list
mutian@mutian:~$ cat /etc/vsftpd.chroot_list
ftpuser
$ sudo groupadd ftpgroup
$ sudo useradd -g ftpgroup -d /opt/ftp -M ftpuser
mutian@mutian:/etc$ sudo service vsftpd stop
mutian@mutian:/etc$ sudo service vsftpd start
vsftpd start/running, process 9347
mutian@mutian:/etc$ sudo service vsftpd restart

 

Browser Access
ftp://10.46.36.218/

 

Terminal Access

 

mutian@mutian:~$ ftp
ftp> open 10.46.36.218
Connected to 10.46.36.218.
220 (vsFTPd 2.3.5)
Name (10.46.36.218:mutian): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> help
Commands may be abbreviated. Commands are:
!    dir    mdelete    qc    site
$    disconnect    mdir    sendport    size
account    exit    mget    put    status
append    form    mkdir    pwd    struct
ascii    get    mls    quit    system
bell    glob    mode    quote    sunique
binary    hash    modtime    recv    tenex
bye    help    mput    reget    tick
case    idle    newer    rstatus    trace
cd    image    nmap    rhelp    type
cdup    ipany    nlist    rename    user
chmod    ipv4    ntrans    reset    umask
close    ipv6    open    restart    verbose
cr    lcd    prompt    rmdir    ?
delete    ls    passive    runique
debug    macdef    proxy    send
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 10 Feb 18 22:49 ss
226 Directory send OK.


mutian@mutian:~/myshare$ ls
apache-tomcat-9.0.0.M1.tar.gz Discuz_X3.2_SC_GBK.zip httpd-2.2.31.tar.gz module.php php-5.6.18.tar.gz readme utility
DedeCMS-V5.7-UTF8-SP1.tar.gz Discuz_X3.2_SC_UTF8.zip in.txt nmap-7.01.tar.bz2 php-7.0.3.tar.gz upload
mutian@mutian:~/myshare$ ftp 10.46.36.218
Connected to 10.46.36.218.
220 (vsFTPd 2.3.5)
Name (10.46.36.218:mutian): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 10 Feb 18 22:49 ss
226 Directory send OK.
ftp> !ls
apache-tomcat-9.0.0.M1.tar.gz Discuz_X3.2_SC_GBK.zip    httpd-2.2.31.tar.gz module.php    php-5.6.18.tar.gz readme utility
DedeCMS-V5.7-UTF8-SP1.tar.gz Discuz_X3.2_SC_UTF8.zip    in.txt    nmap-7.01.tar.bz2    php-7.0.3.tar.gz upload
ftp> get ss
local: ss remote: ss
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for ss (10 bytes).
226 Transfer complete.
10 bytes received in 0.00 secs (73.4 kB/s)
ftp> put Discuz_X3.2_SC_UTF8.zip

 

ftp> put m.cpp
local: m.cpp remote: m.cpp
200 PORT command successful. Consider using PASV.
550 Permission denied.
原因:vsftp默认配置不允许上传文件。
解决:修改/etc/vsftpd.conf
将“write_enable=YES”前面的#取消
重启vsftp服务器。

 

 

ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxrwxrwx    2 0        0            4096 Feb 19 13:18 sx
drwxr-xr-x    2 0        0            4096 Feb 19 13:15 temp
226 Directory send OK.
ftp> cd sx
250 Directory successfully changed.
ftp> pwd
257 "/sx"
ftp> put m.cpp
local: m.cpp remote: m.cpp
200 PORT command successful. Consider using PASV.
553 Could not create file.

mutian@mutian:/opt/ftp$ sudo chmod -R 777 sx
mutian@mutian:/opt/ftp$ ll
total 16
drwxr-xr-x 4 root root 4096 Feb 19 13:15 ./
drwxr-xr-x 4 root root 4096 Feb 19 13:10 ../
drwxrwxrwx 2 root root 4096 Feb 19 13:18 sx/
drwxr-xr-x 2 root root 4096 Feb 19 13:15 temp/

ftp> put m.cpp
local: m.cpp remote: m.cpp
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
716 bytes sent in 0.00 secs (10133.6 kB/s)

 

 

 

 

posted @ 2016-02-18 23:25  牧 天  阅读(200)  评论(0)    收藏  举报