自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

VsFTPd的配置

運維 系統(tǒng)運維
vsftpd是Linux發(fā)行版中最為推崇的FTP服務(wù)器程序,vsftpd的特點是小巧輕快,安全易用。那么該如何配置vsftpd呢?本文講述的就是vsftpd的配置

VsFTPd配置:vsFTPd的運行有兩種模式,一種是standalone "initd"模式,另外一種是xinetd模式。

  兩種模式運行機(jī)制不是相同的,stardard initd模式,適合專業(yè)FTP,且FTP總是一直有人訪問,占用資源也是比較大,如果您的FTP總是有人訪問和登入。就要用這種模式。如果您的FTP訪問人數(shù)比較小,建議您用xinetd模式。xinetd模式,是當(dāng)用戶請求時,vsFTPd才會啟動。

  不同的環(huán)境,當(dāng)然得用不同的啟動模式。

  1] 我們主要把vsFTPd的配置文件改一下就行了。配制文件在/etc/vsftpd/vsftpd.conf,用您喜歡的編輯器打開。請參考下面的配置文件。

  1.   # Example config file /etc/vsftpd.conf  
  2.  
  3.   #  
  4.  
  5.   # The default compiled in settings are very paranoid. This sample file  
  6.  
  7.   # loosens things up a bit, to make the ftp daemon more usable.  
  8.  
  9.   #  
  10.  
  11.   # Allow anonymous FTP?  
  12.  
  13.   anonymous_enable=YES 
  14.  
  15.   #  
  16.  
  17.   # Uncomment this to allow local users to log in.  
  18.  
  19.   local_enable=YES 
  20.  
  21.   #  
  22.  
  23.   # Uncomment this to enable any form of FTP write command.  
  24.  
  25.   write_enable=YES 
  26.  
  27.   #  
  28.  
  29.   # Default umask for local users is 077. You may wish to change this to 022,  
  30.  
  31.   # if your users expect that (022 is used by most other ftpd's)  
  32.  
  33.   local_umask=022 
  34.  
  35.   #  
  36.  
  37.   # Uncomment this to allow the anonymous FTP user to upload files. This only  
  38.  
  39.   # has an effect if the above global write enable is activated. Also, you will  
  40.  
  41.   # obviously need to create a directory writable by the FTP user.  
  42.  
  43.   #anon_upload_enable=YES 
  44.  
  45.   #  
  46.  
  47.   # Uncomment this if you want the anonymous FTP user to be able to create  
  48.  
  49.   # new directories.  
  50.  
  51.   #anon_mkdir_write_enable=YES 
  52.  
  53.   #  
  54.  
  55.   # Activate directory messages - messages given to remote users when they  
  56.  
  57.   # go into a certain directory.  
  58.  
  59.   dirmessage_enable=YES 
  60.  
  61.   #  
  62.  
  63.   # Activate logging of uploads/downloads.  
  64.  
  65.   xferlog_enable=YES 
  66.  
  67.   #  
  68.  
  69.   # Make sure PORT transfer connections originate from port 20 (ftp-data).  
  70.  
  71.   connect_from_port_20=YES 
  72.  
  73.   #  
  74.  
  75.   # If you want, you can arrange for uploaded anonymous files to be owned by  
  76.  
  77.   # a different user. Note! Using "root" for uploaded files is not  
  78.  
  79.   # recommended!  
  80.  
  81.   #chown_uploads=YES 
  82.  
  83.   #chown_username=whoever 
  84.  
  85.   #  
  86.  
  87.   # You may override where the log file goes if you like. The default is shown  
  88.  
  89.   # below.  
  90.  
  91.   #xferlog_file=/var/log/vsftpd.log  
  92.  
  93.   #  
  94.  
  95.   # If you want, you can have your log file in standard ftpd xferlog format  
  96.  
  97.   xferlog_std_format=YES 
  98.  
  99.   #  
  100.  
  101.   # You may change the default value for timing out an idle session.  
  102.  
  103.   #idle_session_timeout=600 
  104.  
  105.   #  
  106.  
  107.   # You may change the default value for timing out a data connection.  
  108.  
  109.   #data_connection_timeout=120 
  110.  
  111.   #  
  112.  
  113.   # It is recommended that you define on your system a unique user which the  
  114.  
  115.   # ftp server can use as a totally isolated and unprivileged user.  
  116.  
  117.   #nopriv_user=ftpsecure 
  118.  
  119.   #  
  120.  
  121.   # Enable this and the server will recognise asynchronous ABOR requests. Not  
  122.  
  123.   # recommended for security (the code is non-trivial). Not enabling it,  
  124.  
  125.   # however, may confuse older FTP clients.  
  126.  
  127.   #async_abor_enable=YES 
  128.  
  129.   #  
  130.  
  131.   # By default the server will pretend to allow ASCII mode but in fact ignore  
  132.  
  133.   # the request. Turn on the below options to have the server actually do ASCII  
  134.  
  135.   # mangling on files when in ASCII mode.  
  136.  
  137.   # Beware that turning on ascii_download_enable enables malicious remote parties  
  138.  
  139.   # to consume your I/O resources, by issuing the command "SIZE /big/file" in  
  140.  
  141.   # ASCII mode.  
  142.  
  143.   # These ASCII options are split into upload and download because you may wish  
  144.  
  145.   # to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),  
  146.  
  147.   # without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be  
  148.  
  149.   # on the client anyway..  
  150.  
  151.   #ascii_upload_enable=YES 
  152.  
  153.   #ascii_download_enable=YES 
  154.  
  155.   #  
  156.  
  157.   # You may fully customise the login banner string:  
  158.  
  159.   #ftpd_banner=Welcome to blah FTP service.  
  160.  
  161.   #  
  162.  
  163.   # You may specify a file of disallowed anonymous e-mail addresses. Apparently  
  164.  
  165.   # useful for combatting certain DoS attacks.  
  166.  
  167.   #deny_email_enable=YES 
  168.  
  169.   # (default follows)  
  170.  
  171.   #banned_email_file=/etc/vsftpd.banned_emails  
  172.  
  173.   #  
  174.  
  175.   # You may specify an explicit list of local users to chroot() to their home  
  176.  
  177.   # directory. If chroot_local_user is YES, then this list becomes a list of  
  178.  
  179.   # users to NOT chroot().  
  180.  
  181.   #chroot_list_enable=YES 
  182.  
  183.   # (default follows)  
  184.  
  185.   #chroot_list_file=/etc/vsftpd.chroot_list  
  186.  
  187.   #  
  188.  
  189.   # You may activate the "-R" option to the builtin ls. This is disabled by  
  190.  
  191.   # default to avoid remote users being able to cause excessive I/O on large  
  192.  
  193.   # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume  
  194.  
  195.   # the presence of the "-R" option, so there is a strong case for enabling it.  
  196.  
  197.   #ls_recurse_enable=YES 
  198.  
  199.   pam_service_name=vsftpd 
  200.  
  201.   userlist_enable=YES 
  202.  
  203.   #enable for standalone mode  
  204.  
  205.   listen=YES 
  206.  
  207.   tcp_wrappers=YES 
  208.  

#p#

  2]更改完配置文件后,我們可以用下面的命令來重啟vsFTPd服務(wù)器

  1.   [root@linuxsir001 root]# /etc/init.d/vsftpd restart  
  2.  

  關(guān)閉 vsftpd: [ 確定 ]

  為 vsftpd 啟動 vsftpd: [ 確定 ]

  1.   [root@linuxsir001 root]#  
  2.  

  3]以匿名方式來訪問測試,在text模式下:

  注意:在text模式下,要用用戶名ftp,密碼ftp來訪問,這才是在text中匿名訪問FTP??慈缦碌牟僮鳎?/P>

  1.   [root@linuxsir001 root]# ftp 192.168.0.1  
  2.  
  3.   Connected to 192.168.0.1.  
  4.  
  5.   220 (vsFTPd 1.1.3)  
  6.  
  7.   530 Please login with USER and PASS.  
  8.  
  9.   530 Please login with USER and PASS.  
  10.  
  11.   KERBEROS_V4 rejected as an authentication type  
  12.  
  13.   Name (192.168.0.1:root): ftp 這里寫上ftp  
  14.  
  15.   331 Please specify the password.  
  16.  
  17.   Password:[這里添寫ftp的密碼],匿名登入密碼也是ftp  
  18.  
  19.   230 Login successful. Have fun.  
  20.  
  21.   Remote system type is UNIX.  
  22.  
  23.   Using binary mode to transfer files.  
  24.  
  25.   ftp> ls  
  26.  
  27.   227 Entering Passive Mode (192,168,0,1,137,151)  
  28.  
  29.   150 Here comes the directory listing.  
  30.  
  31.   drwxr-xr-x 6 0 0 4096 May 25 13:54 RedHat90  
  32.  
  33.   drwxr-xr-x 2 0 0 4096 Feb 28 19:21 pub  
  34.  
  35.   226 Directory send OK.  
  36.  
  37.   ftp> 
  38.  

  那匿名用戶所訪問的是哪個目錄?是/var/ftp這個目錄

  出現(xiàn)問題的解決:有時出錯,是因為沒有ftp和nobody用戶,所以要在系統(tǒng)中添加這兩個用戶,一般的情況下,這兩個用戶在系統(tǒng)中是存在的??聪旅娴牟僮?。

  1.   [root@linuxsir001 root]# adduser ftp  
  2.  
  3.   adduser: user ftp exists  
  4.  
  5.   [root@linuxsir001 root]# adduser nobody  
  6.  
  7.   adduser: user nobody exists  
  8.  

  從上面的操作中可知ftp和nobody用戶是存在的,所以沒有必要添加ftp和nobody用戶了。如果不存在,一定要添加這兩個用戶,否則會出現(xiàn)匿名用戶不能訪問的情況。

  4]如果要以系統(tǒng)中存在的普通用戶登入FTP,也沒有什么可以設(shè)置的,添加一個用戶就行。比如我要添加beinan這個用戶,就要用下面的辦法

  1.   [root@linuxsir001 root]# adduser beinan  
  2.  
  3.   [root@linuxsir001 root]# passwd beinan  
  4.  
  5.   Changing password for user beinan.  
  6.  
  7.   New password:  
  8.  
  9.   BAD PASSWORD: it does not contain enough DIFFERENT characters  
  10.  
  11.   Retype new password:  
  12.  
  13.   passwd: all authentication tokens updated successfully.  
  14.  
  15.   [root@linuxsir001 root]#  
  16.  

  這樣的話,就在/home目錄中出現(xiàn)一個beinan的用戶目錄:如下:

  1.   [root@linuxsir001 root]# ls /home/  
  2.  
  3.   beinan  
  4.  

  如果我們想讓beinan這個用戶作為虛擬用戶,也就是說,beinan這個用戶是不能登入系統(tǒng)的,只能是登入FTP。 那這樣的用戶應(yīng)該如何添加呢??

  1.   [root@linuxsir001 backupNow]# adduser -g ftp -s /sbin/nologin beinan  
  2.  
  3.   [root@linuxsir001 backupNow]# passwd beinan  
  4.  
  5.   Changing password for user beinan.  
  6.  
  7.   New password:  
  8.  
  9.   Retype new password:  
  10.  
  11.   passwd: all authentication tokens updated successfully.  
  12.  
  13.   [root@linuxsir001 backupNow]#  
  14.  

  注:這僅僅是vsFTPd添加虛擬用戶的一個方法,還有更好的辦法需要我們?nèi)W(xué)習(xí)!另外的辦法也在測試之中。嚴(yán)格上來說,這種辦法不能算虛擬用戶。還有另外的一個辦法,就是通過pam認(rèn)證,用db_load來添加用戶,目前我也弄成功了,不過相對要復(fù)雜一點。正在測試之中。

  如果我們想把用戶目錄定位到別的目錄應(yīng)該怎么辦呢??這個也比較簡單,看一下useradd就比較明白了。比如我想添加beinan這個用戶,并把目錄放在/opt目錄中:如下操作:

  1.   [root@linuxsir001 root]# adduser -d /opt/beinan beinan  
  2.  
  3.   [root@linuxsir001 root]# passwd beinan  
  4.  
  5.   Changing password for user beinan.  
  6.  
  7.   New password:  
  8.  
  9.   Retype new password:  
  10.  
  11.   passwd: all authentication tokens updated successfully.  
  12.  

  如果是添加虛擬用戶,也就是不讓用戶登入系統(tǒng),只能登入FTP的用戶。如果我們想把beinan這個用戶目錄定位在/opt/beinan這個目錄中,根據(jù)上面的方法。我們應(yīng)該如下操作

  1.   [root@linuxsir001 backupNow]# adduser -d /opt/beinan -g ftp -s /sbin/nologin beinan  
  2.  
  3.   [root@linuxsir001 backupNow]# passwd beinan  
  4.  
  5.   Changing password for user beinan.  
  6.  
  7.   New password:  
  8.  
  9.   Retype new password:  
  10.  
  11.   passwd: all authentication tokens updated successfully.  
  12.  
  13.   [root@linuxsir001 backupNow]#  
  14.  

  看一下是不是已經(jīng)成功添加到了beinan這個用戶,并把beinan的家目錄放在了/opt目錄中呢??

  1.   [root@linuxsir001 root]# ls /opt/  
  2.  
  3.   beinan  
  4.  

  證明已經(jīng)成功。

#p#

  我們可以在text模式下以beinan用戶登入,然后來訪問ftp。

  1.   [root@linuxsir001 root]# ftp 192.168.0.1  
  2.  
  3.   Connected to 192.168.0.1.  
  4.  
  5.   220 (vsFTPd 1.1.3)  
  6.  
  7.   530 Please login with USER and PASS.  
  8.  
  9.   530 Please login with USER and PASS.  
  10.  
  11.   KERBEROS_V4 rejected as an authentication type  
  12.  
  13.   Name (192.168.0.1:root): beinan  
  14.  
  15.   331 Please specify the password.  
  16.  
  17.   Password:  
  18.  
  19.   230 Login successful. Have fun.  
  20.  
  21.   Remote system type is UNIX.  
  22.  
  23.   Using binary mode to transfer files.  
  24.  
  25.   ftp> 
  26.  

  是不是成功了呢?

  我們也可以用gftp來訪問beinan用戶,并上傳相應(yīng)的東西,所傳上的東西就放在beinan用戶所在的家目錄中,普通用戶的家目錄在哪里,寫您所用的添加用戶的方法有關(guān)。我在前面已經(jīng)說了兩種辦法,一種是默認(rèn)的添加方法,就是放在/home目錄中。

  在本例中,我是采用默認(rèn)的添加用戶的方法。也就是不特別指定用戶用戶,這樣的話,用戶目錄就在/home目錄中。比如用beinan登入FTP時,訪問的就是/home/beinan這個目錄。讓傳的東西也在這個目錄中。匿名用戶所訪問是:/var/ftp這個目錄。

【編輯推薦】

  1. vsftpd.conf 術(shù)語解釋大全
  2. Vsftpd如何匿名訪問
  3. Vsftpd如何實現(xiàn)虛擬路徑
責(zé)任編輯:zhaolei 來源: CSDN
相關(guān)推薦

2011-03-02 11:32:55

vsftpd配置

2011-03-02 13:23:42

Vsftpd配置

2011-03-02 10:19:44

2011-02-22 13:28:43

Linuxvsftpd配置

2010-02-22 18:27:14

CentOS vsft

2011-02-24 09:14:37

vsFTPd虛擬用戶

2011-02-24 10:18:41

CentOS配置vsftpd

2011-02-23 15:50:04

Linuxvsftpd

2011-02-23 17:23:35

linux vsftpd

2011-03-02 10:41:41

Vsftpd安裝

2011-03-04 10:05:10

Vsftpd虛擬用戶

2011-03-02 16:11:38

vsftpd.conf配置

2011-02-23 15:50:04

Linuxvsftpd

2011-03-01 09:44:04

ubuntuvsftpd

2011-03-02 13:12:37

vsftpd配置

2011-03-02 13:28:33

Vsftpd配置

2011-03-02 11:25:10

vsftpd配置

2010-12-27 13:26:25

FreeBSDvsftpd虛擬用戶

2010-08-26 10:28:43

2010-02-26 14:03:11

Fedora vsft
點贊
收藏

51CTO技術(shù)棧公眾號