vsftpd簡單安裝

1、查看ftp服務是否安裝。
2、啓動服務,ntsysv 選中 vsftpd服務
3、編輯 /etc/vsftpd/vsftpd.conf
修改參數:
anonymous_enable = no
Connect_form_port_20=yes
Pam_service_name=vsftpd
Listen=yes
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Write_enable=yes
Local_enable=yes
Chroot_list_enable=yes
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
4、添加用戶
useradd 用戶名
passwd 用戶名
5、建立存儲文件路徑
Mkdir /var/ftp/
6、改變文件所有者。
Chown –R 用戶名:用戶名 /var/ftp/
7、建立受限清單
Touch /etc/vsftpd/vsftpd.chroot_list
Vi /etc/vsftpd/vsftpd.chroot_list
把用戶名加入其中。
8、重啓ftp服務 /etc/init.d/vsftpd restart.
9、試試吧,應該可以了。不行的話留言。
注:我用的是Linux as4 。軟件包全部安裝。

/usr/sbin/vsftpd ---- VSFTPD的主程序
  /etc/rc.d/init.d/vsftpd ---- 啓動腳本
  /etc/vsftpd/vsftpd.conf ---- 主配置文件
  /etc/pam.d/vsftpd ---- PAM認證文件
  /etc/vsftpd.ftpusers ---- 禁止使用VSFTPD的用戶列表文件
  /etc/vsftpd.user_list ---- 禁止或允許使用VSFTPD的用戶列表文件
  /var/ftp ---- 匿名用戶主目錄
  /var/ftp/pub
  ---- 匿名用戶的下載目錄
  1、打開vsFTPd服務器,當然先要安裝,這裏就不說了。
  # ntsysv
  把vsftpd服務器打開,也就是在運行 ntsysv命令後,把vsftpd服務選中。
  [*] vsftpd
  或運行應用程序/usr/bin/system-config-services,把vsftpd選中,或G菜單==系統設置==服務器設置==服務
  2、運行/etc/init.d/vsftpd start
  # /etc/init.d/vsftpd start
  # /etc/init.d/vsftpd restart(重啓vsftpd)
  3、編輯vsftpd.conf
  布爾選項
  allow_anon_ssl=NO(是否使用SSL連接,如果使用匿名用戶將允許使用SSL登陸,默認:NO)
  anon_mkdir_write_enable=YES(允許建立相應的目錄,默認:NO)
  anon_other_write_enable=yes (匿名帳號可以有刪除的權限,默認:NO)
  anon_upload_enable=YES(開放上傳權限,默認:NO)
  anon_world_readable_only=YES (放開匿名用戶瀏覽權限,默認:YES)
  anonymous_enable=YES (允許匿名訪問,默認:YES)
  ascii_upload_enable=YES(控制是否允許使用ASCⅡ模式上傳文件,YES允許,NO不允許,默認:NO)
  ascii_download_enable=YES(控制是否允許使用ASCⅡ模式下載文件,YES允許,NO不允許,默認:NO)
  async_abor_enable=YES(開啓支持早期FTP客戶端“async ABOR"命令的能力,默認:NO)
  background (默認:NO)
  When enabled, and vsftpd is started in "listen" mode, vsftpd will background the listener process. i.e. control will immediately be returned to the shell which launched vsftpd.
  Default: NO
  check_shell=YES(此選項僅對不使用PAM方式的VSFTPD生效,當此選項關閉後,當本地用戶登錄時,VSFTPD不會檢查/etc/shells文件以尋找一個有效的用戶shell,默認:YES)
  chmod_enable=YES(是否使用CHMOD命令,默認:YES)
  chown_uploads=NO(是否激活匿名用戶上傳文件的權限,默認:NO)
  chroot_list_enable=YES(鎖定某些用戶在自家目錄中,即當這些用戶登錄後,不可以轉到系統的其他目錄,只能在自家目錄下,具體的用戶在chroot_list_file參數所指定的文件中列出,默認:NO)
  chroot_local_users =yes(將本地用戶鎖定在自家目錄中,當此項被激活時,chroot_list_enable和chroot_local_users參數的作用將發生變化,chroot_list_file所指定文件中的用戶將不被鎖定在自家目錄,本參數被激活後,可能帶來安全上的衝突,特別是當用戶擁有上傳. shell訪問等權限時,因此,只有在確實瞭解的情況下,纔可以打開此參數,默認:NO)
  connect_from_port_20=YES(是否確信端口傳輸來自20(ftp-data),默認:NO,但配置文件依然使此功能可用)
  deny_email_enable =yes(當值爲YES時,拒絕使用banned_email_file參數指定文件中所列出的e-mail地址進行登錄的匿名用戶,即當匿名用戶使用 banned_email_file文件中所列出的e-mail進行登錄時,被拒絕,顯然,這對於阻擊某些Dos***有效,當此參數生效時,需追加 banned_email_file參數,默認:NO)
  dirlist_enable=YES(所有的目錄list命令將會提供被否認的許可,默認:YES)
  dirmessage_enable=NO(切換目錄時,顯示目錄下.message的內容,默認:NO)
  download_enable=YES(所有的下載請求將會提供被否認的許可,默認:YES)
  dual_log_enable=NO(激活雙日誌模式,地址爲 /var/log/xferlog和/var/log/vsftpd.log,前者爲wu-ftpd日誌類型,後者爲vsftpd日誌類型,默認:NO)
  force_dot_files
  If activated, files and directories starting with . will be shown in directory listings even if the "a" flag was not used by the client. This override excludes the "." and ".." entries.
  Default: NO
  force_local_data_ssl
  Only applies if ssl_enable is activated. If activated, all non-anonymous logins are forced to use a secure SSL connection in order to send and receive data on data connections.
  Default: YES
  force_local_logins_ssl
  Only applies if ssl_enable is activated. If activated, all non-anonymous logins are forced to use a secure SSL connection in order to send the password.
  Default: YES
  guest_enable=YES(若是啓動這項功能,所有的非匿名登入者都視爲guest,默認:NO)
  hide_ids=NO(是否隱藏文件的所有者和組信息,YES,當用戶使用"ls -al"之類的指令時,在目錄列表中所有文件的擁有者和組信息都顯示爲ftp,默認:NO)
  listen=YES(當參數爲NO時,以Xinetd模式運行,當參數爲YES時,以單獨模式運行,建議設爲YES,默認:NO)
  listen_ipv6=NO(是否使用IPv6,默認:NO)
  local_enable=YES(是否允許本地用戶登錄,默認:NO)
  log_ftp_protocol=NO(當此選項激活後,所有的FTP請求和響應都被記錄到日誌中,提供此選項時,xferlog_std_format不能被激活,這個選項有助於調試,默認:NO)
  ls_recurse_enable =NO(是否使用"ls -R"命令,建議不使用,大量消耗服務器資源,默認:NO)
  no_anon_password=NO(控制匿名用戶登入時是否需要密碼,YES不需要,NO需要,默認:NO)
  no_log_lock
  When enabled, this prevents vsftpd from taking a file lock when writing to log files. This option should generally not be enabled. It exists to workaround operating system bugs such as the Solaris / Veritas filesystem combination which has been observed to sometimes exhibit hangs trying to lock log files.
  Default: NO
  one_process_model
  If you have a Linux 2.4 kernel, it is possible to use a different security model which only uses one process per connection. It is a less pure security model, but gains you performance. You really don't want to enable this unless you know what you are doing, and your site supports huge numbers of simultaneously connected users.
  Default: NO
  passwd_chroot_enable=NO(當此選項激活時,與chroot_local_user選項配合,chroot()容器的位置可以在每個用戶的基礎上指定,每個用戶的容器來源於/etc/passwd中每個用戶的自家目錄字段,默認:NO)
  pasv_enable=YES (服務器端用被動模式,PASV模式,默認:YES)
  pasv_promiscuous=NO(此選項激活時,將關閉PASV模式的安全檢查,該檢查確保數據連接和控制連接是來自同一個IP地址,小心打開此選項,此選項唯一合理的用法是存在於由安全隧道方案構成的組織中,默認:NO)
  port_enable=YES(如果你要在數據連接時取消PORT模式時,設此選項爲NO,默認:YES)
  port_promiscuous=NO(設爲YES時,取消PORT安全檢查,該檢查確保外出的數據只能連接到客戶端上,小心打開此選項,默認:NO)
  run_as_launching_user=NO( ,默認:NO)
  Set to YES if you want vsftpd to run as the user which launched vsftpd. This is useful where root access is not available. MASSIVE WARNING! Do NOT enable this option unless you totally know what you are doing, as naive use of this option can create massive security problems. Specifically, vsftpd does not / cannot use chroot technology to restrict file access when this option is set (even if launched by root). A poor substitute could be to use a deny_file setting such as {/*,*..*}, but the reliability of this cannot compare to chroot, and should not be relied on. If using this option, many restrictions on other options apply. For example, options requiring privilege such as non-anonymous logins, upload ownership changing, connecting from port 20 and listen ports less than 1024 are not expected to work. Other options may be impacted.
  Default: NO
   secure_email_list_enable =NO(如果你想建立一個只有指定的電子郵件地址才能作爲匿名登錄密碼的列表,設爲YES,這個在不需要創建虛擬用戶的條件下作爲一個低安全性的訪問控制來說很有用,如果允許的話,只有在email_password_file中指定的電子郵件地址密碼才能登錄,文件的格式是一行一個密碼,默認的文件名是 /etc/vsftpd.email_passwords,默認:NO)
  session_support=NO(這個控制 vsftpd是否爲登錄保持會話,如果vsftpd保持會話,它將會試圖和升級utmp和wtmp,它還會打開一個PAM會話如果使用PAM來認證的話, 只有在退出時纔會關閉,如果你不需要保持會話的話,你可能會希望禁止這個選項,或者你希望vsftpd佔用更少的資源,注意--utmp和wtmp只支持有PAM的情況,默認:NO)
  setproctitle_enable=NO(YES,VSFTPD將在系統進程列表中顯示每個會話 (session)的狀態,進程報告將顯示每個vsftpd會話在做什麼,出於安全的目的.可關閉選項,NO,進程報告只顯示一個vsftpd進程在運行,默認:NO)
  ssl_enable
  If enabled, and vsftpd was compiled against OpenSSL, vsftpd will support secure connections via SSL. This applies to the control connection (including login) and also data connections. You'll need a client with SSL support too. NOTE!! Beware enabling this option. Only enable it if you need it. vsftpd can make no guarantees about the security of the OpenSSL libraries. By enabling this option, you are declaring that you trust the security of your installed OpenSSL library.
  Default: NO
  ssl_sslv2
  Only applies if ssl_enable is activated. If enabled, this option will permit SSL v2 protocol connections. TLS v1 connections are preferred.
  Default: NO
  ssl_sslv3
  Only applies if ssl_enable is activated. If enabled, this option will permit SSL v3 protocol connections. TLS v1 connections are preferred.
  Default: NO
  ssl_tlsv1
  Only applies if ssl_enable is activated. If enabled, this option will permit TLS v1 protocol connections. TLS v1 connections are preferred.
  Default: YES
  syslog_enable=NO(如果允許,任何本來應該輸入出到/var/log/vsftpd/vsftpd.log的log輸入出將會輸入到系統log,在FTPD下記錄這個,默認:NO)
  tcp_wrappers=NO(在VSFTPD中使用TCP_Wrappers遠程訪問控制機制,默認:NO)
  text_userdb_names=NO(當使用者登入後使用指令時,目錄列表的用戶和組信息域,默認是出現擁有者的UID,而不是該檔案擁有者的名稱,若是希望出現擁有者的名稱,則將此功能開啓,默認:NO)
  tilde_user_enable
  If enabled, vsftpd will try and resolve pathnames such as ~chris/pics, i.e. a tilde followed by a username. Note that vsftpd will always resolve the pathnames ~ and ~/something (in this case the ~ resolves to the initial login directory). Note that ~user paths will only resolve if the file /etc/passwd may be found within the _current_ chroot() jail.
  Default: NO
  use_localtime=NO(如果被允許,vsftpd將會在目錄列表中同時顯示你本地時區的時間,默認是顯示GMT,這個選項也影響到用MDTM FTP 命令返回的時間,默認:NO)
  use_sendfile=YES(一個內部設置用於測試在你的平臺上使用sendfile()系統調用的相關的好處,默認:YES)
  userlist_deny =YES(決定禁止還是隻允許由userlist_file指定文件中的用戶登錄FTP服務器,此選項在userlist_enable 選項啓動後才生效,YES,禁止文件中的用戶登錄,同時也不向這些用戶發出輸入口令的提示,NO,只允許在文件中的用戶登錄FTP服務器,默認:YES)
  userlist_enable=NO(在userlist_file文件中的用戶不可以訪問,默認:NO)
  virtual_use_local_privs=NO(當該參數激活時虛擬用戶使用與本地用戶相同的權限,當此參數關閉時,虛擬用戶使用與匿名用戶相同的權限,默認:NO)
  write_enable=YES(控制是否允許使用任何可以修改文件系統的FTP的指令,比如STOR.DELE.RNFR.RNTO.MKD.RMD.APPE以及SITE,默認:NO,不過自帶的簡單配置文件中打開了該選項)
  xferlog_enable=YES(激活上傳和下傳的日誌,地址/var/log/vsftpd.log,默認:NO,但自帶的配置文件中激活了此選項)
  xferlog_std_format=NO(控制日誌文件是否使用xferlog的標準格式,如同wu-ftpd一樣,使用xferlog格式,可以重新使用已經存在的傳輸統計生成器,默認的日誌格式更爲可讀性,默認:NO,但自帶的配置文件中激活了此選項)
  數字選擇
  accept_timeout=60(接受建立聯機的超時設定,單位爲秒,默認:60)
  anon_max_rate=30000(匿名用戶傳輸率30K,單位爲Bytes/s,默認:0 不限)
  anon_umask=077(匿名登入者新增檔案時的umask數值,默認值爲077)
  data_connection_timeout=300(空閒的數據連接的超時時間,單位爲秒,默認:300)
  connect_timeout=60(響應PORT方式的數據聯機的超時設定,單位爲秒,默認:60,以上兩個選項針對客戶端的,將使客戶端空閒1分鐘後自動中斷連接,並在中斷1分鐘後自動激活連接)
  file_open_mode=0666(上傳檔案的權限,與chmod 所使用的數值相同,如果希望上傳的文件可以執行,設此值爲0777,默認:0666)
  ftp_data_port=20(FTP數據連接端口,需connect_from_port_20激活,默認:20)
  idle_session_timeout=300(空閒用戶會話的超時時間,若是超出這時間沒有數據的傳送或是指令的輸入,則會強迫斷線,單位爲秒,默認:300)
  Listen_port=21(指定FTP服務器監聽的端口號,此選項在standalone模式下生效,默認:21)
  Local_max_rate=50000(本地用戶傳輸率50K,默認:0不限)
  local_umask=077(FTP上本地的文件權限,如果你指定的是一個八進制數,請在前面加上一個0,否則認爲是十進制數,默認:077)
  max_clients=200(FTP的最大連接數,默認:0不限)
  max_per_ip=4(每IP的最大連接數,默認:0不限)
  pasv_min_port=50000
  pasv_max_port=60000(設定在PASV模式下,建立數據傳輸所可以使用port範圍的下界和上界,0 表示任意,把端口範圍設在比較高的一段範圍內50000—60000之間,默認:0)
  trans_chunk_size=0(你可能不想改變它,如果是帶寬限制,試着設爲8192等,默認: 0 ,讓vsftpd選擇一個比較好的)
  字符選擇
  anon_root=/vra/ftp (匿名的目錄,默認:none)
  banned_email_file=/etc/vsftpd.banned_emails(是否允許禁止匿名用戶使用某些郵件地址,如果是輸入禁止的郵件地址的路徑和文件名,默認:/etc/vsftpd.banned_emails)
  banner_file=/var/vsftpd_banner_file (用戶連接後歡迎信息使用的是此文件中的相關信息,默認:none)
  chown_username=root(是否修改匿名用戶所上傳文件的所有權,YES,匿名用戶所上傳的文件的所有權將改爲另外一個不同的用戶所有,用戶由chown_username參數指定,默認:root)
  chroot_list_file=/etc/vsftpd.chroot_list(指出被鎖定在自家目錄中的用戶的列表文件。文件格式爲一行一用戶,默認:/etc/vsftpd.chroot_list)
  cmds_allowed=PASV,RETR,QUIT(允許用戶使用命令列表,中間用英文逗號隔開,默認:none)
  deny_file={*.mp3,*.mov,.private}(拒絕訪問文件類型,默認:none)
  dsa_cert_file=none((使用SSL連接時DRSA證書的位置,默認:none)
  email_password_file=/etc/vsftpd.email_passwords (vsftpd.email_passwords文件中指定的電子郵件地址密碼才能登錄默認:/etc/vsftpd.email_passwords)
  ftp_username=ftp(匿名用戶所使用的系統用戶名,默認下,此參數在配置文件中不出現,默認:ftp)
  ftpd_banner=Welcome to Zxs FTP service.(定製歡迎信息,默認:none)
  guest_username=ftp (當guest_enable激活時,定義VSFTPD的guest用戶在系統中的用戶名,默認:ftp)
  hide_file={*.mp3,.hidden,hide*,h?} (隱藏文件類型,默認:none)
  listen_address =192.168.0.1(此參數在VSFTPD使用單獨(standalone)模式下有效,此參數定義了在主機的哪個IP地址上監聽FTP請求,即在哪個IP地址上提供FTP服務,對於只有一個IP地址的主機,不需要使用此參數,對於多址主機,不設置此參數,則監聽所有IP地址,默認:none)
  listen_address6=none (同上,不過IP爲IPV6格式,默認:none)
  local_root=none(定義所有本地用戶的根目錄,當本地用戶登入時,將被更換到此目錄下,默認:none)
  message_file=.message(設置訪問一個目錄時獲得的目錄信息文件的文件名,默認:.message)
  nopriv_user=nobody(指定一個安全用戶賬,讓FTP服務器用作完全隔離和沒有特權的獨立用戶,這是vsftpd系統推薦選項,默認:nobody)
  pam_service_name=ftp(FTP服務器名,默認:ftp )
  pasv_address=none (此選項爲一個數字IP地址,作爲PASV命令的響應,即地址是從呼入的連接套接字(incoming connectd socket)中獲取,默認爲none)
  rsa_cert_file=/usr/share/ssl/certs/vsftpd.pem(使用SSL連接時RSA證書的位置,默認:/usr/share/ssl/certs/vsftpd.pem)
  secure_chroot_dir =/usr/share/empty(這選項指向一個空目錄,並且ftp用戶對此目錄無寫權限。當vsftpd不需要訪問文件系統時,這個目錄將被作爲一個安全的容器,用戶將被限制在此目錄中。默認目錄爲/usr/share/empty)
  ssl_ciphers (SSL安裝密碼,默認:DES-CBC3-SHA )
  user_config_dir =none(定義用戶個人配置文件所在的目錄,用戶的個人配置文件爲該目錄下的同名文件,個人配置文件的格式與vsftpd.conf格式相同,例如定義 user_config_dir=/etc/vsftpd/userconf,並且主機上有用戶zxs,zxs1,那我們可以在 user_config_dir的目錄新增名爲zxs,zxs1的兩個文件。當用戶zxs1登入時,VSFTPD則會讀取user_config_dir 下lisi這個文件中的設定值,應用於用戶zxs1i,默認:none)
  user_sub_token=none (默認:none )
  This option is useful is conjunction with virtual users. It is used to automatically generate a home directory for each virtual user, based on a template. For example, if the home directory of the real user specified via guest_username is /home/virtual/$USER, and user_sub_token is set to $USER, then when virtual user fred logs in, he will end up (usually chroot()'ed) in the directory /home/virtual/fred. This option also takes affect if local_root contains user_sub_token.
  Default: (none)
  Userlist_file=/指定的路徑/vsftpd.user_list(指出userlist_enable選項生效後,被讀取的包含用戶列表的文件,默認: /var/log/vsftpd.log )
  vsftpd_log_file
  This option is the name of the file to which we write the vsftpd style log file. This log is only written if the option xferlog_enable is set, and xferlog_std_format is NOT set. Alternatively, it is written if you have set the option dual_log_enable. One further complication - if you have set syslog_enable, then this file is not written and output is sent to the system log instead
  xferlog_file=/var/log/vsftpd.log(日誌存放地址,默認: /var/log/vsftpd.log)
  如要建立虛擬目錄,請用#mount --bind [原有的目錄] [新目錄]命令
  如/home/zxs 映射爲[url]ftp://localhost/zxs[/url]
  查看誰登陸了FTP,並殺死它的進程
  ps –xf |grep ftp
  kill 進程號
  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章