国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 >

    Linux 下FTP的安裝與配置教程步驟

    時(shí)間: 加城1195 分享

      Linux繼承了Unix以網(wǎng)絡(luò)為核心的設(shè)計(jì)思想,是一個(gè)性能穩(wěn)定的多用戶網(wǎng)絡(luò)操作系統(tǒng)。ftp文件管理,可能很多人在Windows中經(jīng)常用到,那么在Linux如何使用呢?這篇文章主要介紹了Linux 下FTP的安裝與配置教程詳解,需要的朋友可以參考下

      方法步驟

      0、安裝ftp的前置條件是關(guān)掉SElinux

      # vi /etc/selinux/config

      修改 SELINUX=” disabled ” ,重啟服務(wù)器。若相同,則跳過此步驟。

      1、 可先查看是否安裝過vsftp

      # rpm -qa | grep vsftpd

      則代表已經(jīng)安裝??芍苯犹^步驟2

      2 、安裝 vsftp

      # yum install vsftp*

      Is this ok [y/N]: y

      代表安裝完成。

      3、 對(duì)vsftp 進(jìn)行配置

      # /etc/vsftpd/vsftpd.conf

      將原始最后三行注釋掉

      添加以下信息:

      #設(shè)定不允許匿名訪問

      anonymous_enable=NO

      #設(shè)定本地用戶可以訪問。注:如使用虛擬宿主用戶,在該項(xiàng)目設(shè)定為NO的情況下所有虛擬用戶將無法訪問

      local_enable=YES

      #使用戶不能離開主目錄

      chroot_list_enable=YES

      #設(shè)定支持ASCII模式的上傳和下載功能

      ascii_upload_enable=YES

      ascii_download_enable=YES

      #PAM認(rèn)證文件名。PAM將根據(jù)/etc/pam.d/vsftpd進(jìn)行認(rèn)證

      pam_service_name=vsftpd

      #設(shè)定啟用虛擬用戶功能

      guest_enable=YES

      #指定虛擬用戶的宿主用戶,CentOS中已經(jīng)有內(nèi)置的ftp用戶了

      guest_username=ftp

      #設(shè)定虛擬用戶個(gè)人vsftp的CentOS FTP服務(wù)文件存放路徑。存放虛擬用戶個(gè)性的CentOS FTP服務(wù)文件(配置文件名=虛擬用戶名)

      user_config_dir=/etc/vsftpd/vuser_conf

      插入后按下Esc鍵后用:wq結(jié)束

      進(jìn)行認(rèn)證

      4、首先 安裝Berkeley DB工具,很多人找不到db_load的問題就是沒有安裝這個(gè)包

      # yum install db4 db4-utils

      然后,創(chuàng)建用戶密碼文本/etc/vsftpd/vuser_passwd.txt ,注意奇行是用戶名,偶行是密碼

      # touch /etc/vsftpd/vuser_passwd.txt

      # vi /etc/vsftpd/vuser_passwd.txt

      注意(如果多個(gè)用戶名和密碼中間不能有空的換行,在最后一個(gè)密碼后必須有換行)

      比如

      本示只創(chuàng)建一個(gè)用戶

      5、接著,生成虛擬用戶認(rèn)證的db文件

      # db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db

      編輯認(rèn)證文件/etc/pam.d/vsftpd,打開這文件,用“#”注釋掉原先的所有內(nèi)容,然后增加兩行。(查看服務(wù)器配置參看步驟9)

      32位系統(tǒng)增加以下兩句:

      auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd

      account required pam_userdb.so db=/etc/vsftpd/vuser_passwd

      64位系統(tǒng)增加以下兩句:

      auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd

      account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd

      本服務(wù)器系統(tǒng)是64位版本

      # /etc/pam.d/vsftpd

      auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd

      account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd

      6、最后,創(chuàng)建虛擬用戶個(gè)性服務(wù)文件

      # mkdir /etc/vsftpd/vuser_conf/

      # touch/etc/vsftpd/vuser_conf/test

      # vi /etc/vsftpd/vuser_conf/test

      添加內(nèi)容如下

      #虛擬用戶根目錄,根據(jù)實(shí)際情況修改

      local_root=/ftp/www

      #可寫

      write_enable=YES

      #掩碼

      anon_umask=022

      anon_world_readable_only=NO

      anon_upload_enable=YES

      anon_mkdir_write_enable=YES

      anon_other_write_enable=YES

      7、創(chuàng)建ftp根目錄權(quán)限

      # mkdir /ftp/www

      # chmod R 777 /ftp

      # chmod R 777 /ftp/www

      8、重啟iptabls和vsftpd

      # service iptables restart

      # service vsftpd restart

      9、查看linux版本是32 還是64位

      $su - root

      #file /sbin/init

      /sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),

      即是32位的 linux, 如是64位的, 顯示的是 64-bit

      補(bǔ)充:Linux基本命令

     ?、賚s 意為list 列出當(dāng)前文件夾中的文件

      -l 顯示文件的屬性 可用ll來表示

     ?、赼lias 別名 看看是否有別名的文件

     ?、踓d dir 跳躍目錄 -P選項(xiàng) 將路徑中的鏈接文件替換成鏈接指向的文件路徑

     ?、躳wd 查看當(dāng)前工作的文件夾名 使用-P的選項(xiàng),會(huì)直接進(jìn)入到其中,相當(dāng)于cd

      相關(guān)閱讀:Linuxshell腳本不執(zhí)行問題實(shí)例分析

      shell腳本不執(zhí)行問題:某天研發(fā)某同事找我說幫他看看他寫的shell腳本,死活不執(zhí)行,報(bào)錯(cuò)。我看了下,腳本很簡(jiǎn)單,也沒有常規(guī)性的錯(cuò)誤,報(bào)“:badinterpreter:Nosuchfileordirectory”錯(cuò)??催@錯(cuò),我就問他是不是在windows下編寫的腳本,然后在上傳到linux服務(wù)器的……果然。原因:在DOS/windows里,文本文件的換行符為rn,而在*nix系統(tǒng)里則為n,所以DOS/Windows里編輯過的文本文件到了*nix里,每一行都多了個(gè)^M。解決:

      1)重新在linux下編寫腳本;

      2)vi:%s/r//g:%s/^M//g(^M輸入用Ctrl+v,Ctrl+m)附:sh-x腳本文件名,可以單步執(zhí)行并回顯結(jié)果,有助于排查復(fù)雜腳本問題。


    Linux 下FTP的安裝與配置相關(guān)文章:

    1.linux中ftp下載文件命令的用法

    2.linux中的ftp命令用法

    3.Linux下MySQL的安裝與配置

    4.linux中ftp命令找不到的原因和解決方法

    5.Linux的Ubuntu操作系統(tǒng)的安裝教程

    4016954