linux FTP配置詳解

來源:互聯網
上載者:User

linux FTP配置詳解 一.vsftpd說明:  www.2cto.com  LINUX下實現FTP服務的軟體很多,最常見的有vsftpd,Wu-ftpd和Proftp等.Red Hat Enterprise Linux中預設安裝的是vsftpd.   訪問FTP伺服器時需要經過驗證,只有經過了FTP伺服器的相關驗證,使用者才能訪問和傳輸檔案.vsftpd提供了3種ftp登入形式:    (1)anonymous(匿名帳號) 使用anonymous是應用廣泛的一種FTP伺服器.如果使用者在FTP伺服器上沒有帳號,那麼使用者可以以anonymous為使用者名稱,以自己的電子郵件地址為密碼進行登入.當匿名使用者登入FTP伺服器後,其登入目錄為匿名FTP伺服器的根目錄/var/ftp.為了減輕FTP伺服器的負載,一般情況下,應關閉匿名帳號的上傳功能.   (2)real(真實帳號) real也稱為本地帳號,就是以真實的使用者名稱和密碼進行登入,但前提條件是使用者在FTP伺服器上擁有自己的帳號.用真實帳號登入後,其登入的目錄為使用者自己的目錄,該目錄在系統建立帳號時系統就自動建立.   (3)guest(虛擬帳號) 如果使用者在FTP伺服器上擁有帳號,但此帳號只能用於檔案傳輸服務,那麼該帳號就是guest,guest是真實帳號的一種形式,它們的不同之處在於,geust登入FTP伺服器後,不能訪問除宿主目錄以外的內容.   二.FTP相關設定檔說明 其相關設定檔有/etc/vsftpd/vsftpd.conf,  /etc/vsftpd.ftpusers,  /etc/vsftpd.user_list,在配置FTP伺服器時,主要是修改這些檔案中的相關語句. 1.vsftpd.conf檔案說明 # Example config file /etc/vsftpd/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  //是否允許anonymous登入FTP伺服器,預設是允許的. # # Uncomment this to allow local users to log in. local_enable=YES //是否允許本機使用者登入FTP伺服器,預設是允許 # # Uncomment this to enable any form of FTP write command. write_enable=YES  //是否允許使用者具有在FTP伺服器檔案中執行寫的許可權,預設是允許 # # 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 //設定本機使用者的檔案產生掩碼為022,預設是077 # # 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  //是否允許匿名賬戶在FTP伺服器中建立目錄 # # 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   //啟用FTP資料連接埠的串連請求 # # 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 xferlog_std_format=YES//是否使用標準的ftpd xferlog記錄檔格式 # # You may change the default value for timing out an idle session. #idle_session_timeout=600  //設定閒置使用者會話停機時間,預設是10分鐘 # # You may change the default value for timing out a data connection. #data_connection_timeout=120//設定資料連線逾時時間,預設是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 turning on ascii_download_enable enables malicious remote parties # to consume your I/O resources, by issuing the command "SIZE /big/file" in # ASCII mode. # These ASCII options are split into upload and download because you may wish # to enable ASCII uploads (to prevent uploaded scripts etc. from breaking), # without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be # on the client anyway.. #ascii_upload_enable=YES #ascii_download_enable=YES //是否允許使用ASCII格式來上傳和下載檔案 # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service.//在FTP伺服器中設定歡迎登入的資訊. # # 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(). #chroot_list_enable=YES //如果希望使用者登入後不能切換到自己目錄以外的其它目錄,需要設定該項,如果設定chroot_list_enable=YES,那麼只允許/etc/vsftpd.chroot_list中列出的使用者具有該功能.如果希望所有的本機使用者都執行者chroot,可以增加一行:chroot_local_user=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 pam_service_name=vsftpd  //設定PAM認證服務的設定檔名稱,該檔案存放在/etc/pam.d/目錄下. userlist_enable=YES //使用者列表中的使用者是否允許登入FTP伺服器,預設是不允許 #enable for standalone mode listen=YES  //使vsftpd 處於獨立啟動模式 tcp_wrappers=YES  //使用tcp_wrqppers作為主機存取控制方式 2.vsftpd.ftpusers檔案說明 這個檔案是用來記錄"不允許"登入到FTP伺服器的使用者,通常是一些系統預設的使用者. 下面是該檔案中預設的不允許登入的名單: # Users that are not allowed to login via ftp root //預設情況下,root和它以下的使用者是不允許登入FTP伺服器的.可以將不允許登入的使用者添加到這裡來.但切記每個使用者都要單獨佔用一行. bin daemon adm lp sync shutdown halt mail news uucp operator games nobody 3.vsftpd.user_list檔案說明 其實它的內容跟上面那個檔案內容一樣,只是在系統對檔案vsftpd.conf 進行檢測時,會檢測到"userlist_deny=YES",因此這個檔案必須存在.下面是這個檔案的內容. # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd.ftpusers # for users that are denied. root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.