湖濱散記部落格的樹心幽徑[login][主頁]
320:20150830vsftp3.03setup success

(1)下載
[root@localhost lnx]# pwd
/root/lnx
[root@localhost lnx]# wget https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz.asc
--2015-08-30 10:29:07--  https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz.asc
正在查找主機 security.appspot.com (security.appspot.com)... 74.125.204.141, 2404:6800:4008:c02::8d
正在連接 security.appspot.com (security.appspot.com)|74.125.204.141|:443... 連上了。
已送出 HTTP 要求,正在等候回應... 200 OK
長度: 未指定 [text/plain]
Saving to: ‘vsftpd-3.0.3.tar.gz.asc’

    [ <=>                                            ] 181         --.-K/s   in 0s

2015-08-30 10:29:07 (35.4 MB/s) - ‘vsftpd-3.0.3.tar.gz.asc’ saved [181]

[root@localhost lnx]#

[root@localhost lnx]# wget https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz
--2015-08-30 10:31:08--  https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz
正在查找主機 security.appspot.com (security.appspot.com)... 74.125.204.141, 2404:6800:400  8:c02::8d
正在連接 security.appspot.com (security.appspot.com)|74.125.204.141|:443... 連上了。
已送出 HTTP 要求,正在等候回應... 200 OK
長度: 未指定 [application/x-tar]
Saving to: ‘vsftpd-3.0.3.tar.gz’

    [  <=>                                           ] 196,649      477KB/s   in 0.4s

2015-08-30 10:31:14 (477 KB/s) - ‘vsftpd-3.0.3.tar.gz’ saved [196649]

[root@localhost lnx]#



(2)解開

[root@localhost lnx]# tar xvzf vsftpd-3.0.3.tar.gz

(3)現況
[root@localhost lnx]# cd vsftpd-3.0.3/
[root@localhost vsftpd-3.0.3]# pwd
/root/lnx/vsftpd-3.0.3
[root@localhost vsftpd-3.0.3]# date
日  8月 30 10:32:26 CST 2015
[root@localhost vsftpd-3.0.3]# uname -a
Linux localhost.localdomain 3.14.19-100.fc19.i686.PAE #1 SMP Wed Sep 17 22:23:56 UTC 2014 i686 i686 i386 GNU/Linux
[root@localhost vsftpd-3.0.3]# ls
access.c     ftpcmdio.h     opts.h            REWARD            sysstr.c
access.h     ftpcodes.h     parseconf.c       secbuf.c          sysstr.h
ascii.c      ftpdataio.c    parseconf.h       secbuf.h          sysutil.c
ascii.h      ftpdataio.h    port              seccompsandbox.c  sysutil.h
AUDIT        ftppolicy.c    postlogin.c       seccompsandbox.h  tcpwrap.c
banner.c     ftppolicy.h    postlogin.h       SECURITY          tcpwrap.h
banner.h     hash.c         postprivparent.c  secutil.c         TODO
BENCHMARKS   hash.h         postprivparent.h  secutil.h         tunables.c
BUGS         INSTALL        prelogin.c        session.h         tunables.h
builddefs.h  ipaddrparse.c  prelogin.h        SIZE              TUNING
Changelog    ipaddrparse.h  privops.c         SPEED             twoprocess.c
COPYING      LICENSE        privops.h         ssl.c             twoprocess.h
COPYRIGHT    logging.c      privsock.c        ssl.h             utility.c
defs.h       logging.h      privsock.h        sslslave.c        utility.h
dummyinc     ls.c           ptracesandbox.c   sslslave.h        vsf_findlibs.sh
EXAMPLE      ls.h           ptracesandbox.h   standalone.c      vsftpd.8
FAQ          main.c         README            standalone.h      vsftpd.conf
features.c   Makefile       README.security   str.c             vsftpd.conf.5
features.h   netstr.c       README.ssl        str.h             vsftpver.h
filesize.h   netstr.h       readwrite.c       strlist.c         xinetd.d
filestr.c    oneprocess.c   readwrite.h       strlist.h
filestr.h    oneprocess.h   RedHat            sysdeputil.c
ftpcmdio.c   opts.c         REFS              sysdeputil.h
[root@localhost vsftpd-3.0.3]#

(4)
[root@insecta vsftpd-3.0.2]# cat INSTALL |more

(5a)

[root@localhost vsftpd-3.0.3]# make
[root@localhost vsftpd-3.0.3]# make install
:
err

(5b)
[root@localhost vsftpd-3.0.3]# useradd nobody
useradd: user 'nobody' already exists
[root@localhost vsftpd-3.0.3]#

(5c)
[root@localhost vsftpd-3.0.3]#  mkdir /usr/share/empty/
mkdir: 無法建立目錄‘/usr/share/empty/’: 檔案已存在
[root@localhost vsftpd-3.0.3]#

(5d)
[root@localhost vsftpd-3.0.3]#  mkdir /var/ftp/
[root@localhost vsftpd-3.0.3]# useradd -d /var/ftp ftp
useradd: user 'ftp' already exists
[root@localhost vsftpd-3.0.3]#

(5e)
[root@localhost vsftpd-3.0.3]#  chown root.root /var/ftp
[root@localhost vsftpd-3.0.3]# chmod og-w /var/ftp
[root@localhost vsftpd-3.0.3]#

(5f)
[root@localhost vsftpd-3.0.3]# cp vsftpd /usr/local/sbin/vsftpd
cp:是否覆寫 ‘/usr/local/sbin/vsftpd’? y
[root@localhost vsftpd-3.0.3]# cp vsftpd.conf.5 /usr/local/man/man5
[root@localhost vsftpd-3.0.3]# cp vsftpd.8 /usr/local/man/man8
[root@localhost vsftpd-3.0.3]#

[root@localhost vsftpd-3.0.3]# cp vsftpd.conf /etc


(5g)
[root@localhost vsftpd-3.0.3]# stat /usr/local/sbin/vsftpd
  File: ‘/usr/local/sbin/vsftpd’
  Size: 150124          Blocks: 296        IO Block: 4096   普通檔案
Device: fd01h/64769d    Inode: 2002015     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-08-30 10:40:17.550379503 +0800
Modify: 2015-08-30 10:40:56.930376610 +0800
Change: 2015-08-30 10:40:56.930376610 +0800
 Birth: -
[root@localhost vsftpd-3.0.3]#



(5h)

[root@localhost vsftpd-3.0.3]# stat /etc/vsftpd.conf
  File: ‘/etc/vsftpd.conf’
  Size: 4593            Blocks: 16         IO Block: 4096   普通檔案
Device: fd01h/64769d    Inode: 1714987     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-08-30 10:42:31.950369629 +0800
Modify: 2015-08-30 10:42:31.950369629 +0800
Change: 2015-08-30 10:42:31.950369629 +0800
 Birth: -
[root@localhost vsftpd-3.0.3]#


(5i)
[root@localhost vsftpd-3.0.3]# /usr/local/sbin/vsftpd -v
vsftpd: version 3.0.3
[root@localhost vsftpd-3.0.3]# cat /etc/vsftpd.conf|grep listen
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
[root@localhost vsftpd-3.0.3]#



(6a)

[root@localhost vsftpd-3.0.3]# /usr/local/sbin/vsftpd &
[1] 5416
[root@localhost vsftpd-3.0.3]# ftp localhost
Trying ::1...
ftp: connect to address ::1連線被拒絕
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 3.0.3)
Name (localhost:root): root
530 This FTP server is anonymous only.
Login failed.
ftp> quit
221 Goodbye.
[root@localhost vsftpd-3.0.3]#

[root@localhost vsftpd-3.0.3]# ps ax|grep ftp
 5416 pts/0    S      0:00 /usr/local/sbin/vsftpd
 5436 pts/0    S+     0:00 grep --color=auto ftp
[root@localhost vsftpd-3.0.3]#

[root@localhost vsftpd-3.0.3]# ftp localhost
Trying ::1...
ftp: connect to address ::1連線被拒絕
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220 (vsFTPd 3.0.3)
Name (localhost:root): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,178,161).
150 Here comes the directory listing.
226 Directory send OK.
ftp> quit
221 Goodbye.
[root@localhost vsftpd-3.0.3]#



(7)

[root@localhost vsftpd-3.0.3]# cp RedHat/vsftpd.pam /etc/pam.d/ftp
[root@localhost vsftpd-3.0.3]#
[root@localhost vsftpd-3.0.3]# cat /etc/pam.d/ftp
#%PAM-1.0
auth       required     /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth       required     /lib/security/pam_unix.so shadow nullok
auth       required     /lib/security/pam_shells.so
account    required     /lib/security/pam_unix.so
session    required     /lib/security/pam_unix.so
[root@localhost vsftpd-3.0.3]#



(8)

[root@localhost vsftpd-3.0.3]# vi /etc/vsftpd.conf
[root@localhost vsftpd-3.0.3]# cat /etc/vsftpd.conf
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
[root@localhost vsftpd-3.0.3]#


select id,article_id,topic,text from lt_articles_text where article_id =320; ok. update lt_articles set num_reads=num_reads +1 where id=320; ok.