東坡下載:內(nèi)容最豐富最安全的下載站!

首頁IT技術(shù)服務(wù)器 → ftp匿名用戶,虛擬用戶,配置文件參數(shù)含義

ftp匿名用戶,虛擬用戶,配置文件參數(shù)含義

相關(guān)文章發(fā)表評論 來源:本站原創(chuàng)時(shí)間:2014/2/20 19:04:55字體大小:A-A+

更多

作者:不詳點(diǎn)擊:354次評論:0次標(biāo)簽: ftp

網(wǎng)絡(luò)文件共享的幾種方式

HTTP NFS(unix like) SAMBA FTP

vsftpd (Very Secure FTP)

ftp需要兩個(gè)端口

21:命令端口

20:數(shù)據(jù)端口

是一種跨平臺的文件傳輸工具。

ftp有兩種傳輸模式

1、主動模式

服務(wù)器的端口:21,20

2、被動模式

服務(wù)器的端口:21,隨機(jī)端口

ftp主動模式和被動模式的區(qū)別:

主動模式:

主動模式的過程:

任何端口到FTP服務(wù)器的21端口(客戶端初始化的連接 S<-C)

FTP服務(wù)器的21端口到大于1023的端口(服務(wù)器響應(yīng)客戶端的控制端口S->C)

FTP服務(wù)器的20端口到大于1023的端口(服務(wù)器端初始化數(shù)據(jù)連接到客戶端的數(shù)據(jù)端口 S->C)

大于1023端口到FTP服務(wù)器的20端口(客戶端發(fā)送ACK響應(yīng)到服務(wù)器的數(shù)據(jù)端口 S<-C)

當(dāng)用戶登錄到ftp服務(wù)器的時(shí)候,匿名用戶進(jìn)入到/var/ftp,系統(tǒng)帳戶進(jìn)入到自己的家目錄

ftp的被動模式

從任何端口到服務(wù)器的21端口(客戶端初始化的連接 S<-C)

服務(wù)器的21端口到任何大于1023的端口(服務(wù)器響應(yīng)到客戶端的控制端口的連接 S->C)

從任何端口到服務(wù)器的大于1023端口(入;客戶端初始化數(shù)據(jù)連接到服務(wù)器指定的任意端口 S<-C)

服務(wù)器的大于1023端口到遠(yuǎn)程的大于1023的端口(出;服務(wù)器發(fā)送 ACK響應(yīng)和數(shù)據(jù)到客戶端的數(shù)據(jù)端口 S->C)

軟件安裝:

#yum install vsftpd -y

服務(wù)啟動:

#servicevsftpd start

#/etc/init.d/vsftpdstart

#chkconfigvsftpd on

# netstat -antulp | grep vsftpd

tcp  0   0 0.0.0.0:21     0.0.0.0:*       LISTEN      28997/vsftpd

配置文件的位置:

/etc/vsftpd/vsftpd.conf

在編輯配置文件之前,最好備份一份,以防萬一

ftp配置的目標(biāo):

1、搞定匿名帳戶的訪問

2、本地帳戶

3、虛擬帳戶

匿名用戶訪問:

#vi /etc/vsftpd/vsftpd.conf

12anonymous_enable=YES   //允許匿名用戶登錄

//匿名用戶指的是: ftpanonymous

28anon_upload_enable=YES //匿名用戶可以上傳

#cd /

# touch a

# ftp localhost

Connected to localhost.localdomain.

220 (vsFTPd 2.0.5)

530 Please login with USER and PASS.

530 Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type

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,50,241)

150 Here comes the directory listing.

drwxr-xr-x   2 0        0            4096 Oct 13 13:29 pub

226 Directory send OK.

ftp> cd pub

250 Directory successfully changed.

ftp> ls

227 Entering Passive Mode (127,0,0,1,191,136)

150 Here comes the directory listing.

226 Directory send OK.

ftp> put a

local: a remote: a

227 Entering Passive Mode (127,0,0,1,192,96)

553 Could not create file.

ftp> quit

221 Goodbye.

允許匿名用戶上傳但是為什么上傳不了文件呢?

還必須看目錄有沒有可寫權(quán)限。

# chmod 777 /var/ftp/pub

# ftp localhost

Connected to localhost.localdomain.

220 (vsFTPd 2.0.5)

530 Please login with USER and PASS.

530 Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type

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,200,175)

150 Here comes the directory listing.

drwxrwxrwx   2 0        0            4096 Oct 13 13:29 pub

226 Directory send OK.

ftp> cd pub

250 Directory successfully changed.

ftp> put a

local: a remote: a

227 Entering Passive Mode (127,0,0,1,168,25)

150 Ok to send data.

226 File receive OK.

ftp> quit

221 Goodbye.

----------------------------------------------

本地帳戶

指的就是服務(wù)器本身的擁有的帳號

vim/etc/vsftpd/vsftpd.conf

anonymouns_enable=NO

#anon_upload_enable=YES

15  local_enable=YES

//本地帳戶認(rèn)證方式啟動

18  write_enable=YES

//表示開啟寫權(quán)限

22  local_umask=022

//表示上傳文件的權(quán)限掩碼

/etc/init.d/vsftpdrestart

ftplocalhost

ftp>cd /etc

ftp>pwd

/etc

那么這個(gè)時(shí)候,就可以下載u1擁有權(quán)限的任意文件。用戶u1可以隨意切換所在目錄

解決用戶瞎溜達(dá)的問題?

vim/etc/vsftpd/vsftpd.conf

96  chroot_list_enable=YES

98  chroot_list_file=/etc/vsftpd/chroot_list

vim /etc/vsftpd/chroot_list

u1

u2

//表示這是一個(gè)關(guān)于chroot的黑名單,凡是在chroot_list中出現(xiàn)的用戶名

//都會實(shí)現(xiàn)chroot的限制

限制所有的本地用戶:

vim/etc/vsftpd/vsftpd.conf

chroot_local_user=YES

限制用戶chroot的白名單設(shè)置:

vim/etc/vsftpd/vsftpd.conf

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

//chroot_list文件中,列出不進(jìn)行chroot限制的用戶列表

ftp

虛擬帳戶

具體實(shí)現(xiàn):

1.通過創(chuàng)建本地?cái)?shù)據(jù)庫實(shí)現(xiàn)虛擬用戶

#yum   install db4-utils -y

創(chuàng)建一個(gè)用于映射虛擬用戶的真實(shí)用戶:

#useradd -d /var/ftp/vuserdir -s /sbin/nlogin  vuser

2.修改配置文件:

#vim/etc/vsftpd/vsftpd.conf

guest_enable=YES

guest_username=vuser

3.生成虛擬用戶文件

#vim/etc/vsftpd/vftpuser.txt

neo

123

mike

456

4.生成虛擬用戶數(shù)據(jù)文件

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

#chmod600 /etc/vsftpd/vftpuser.db

5.創(chuàng)建一個(gè)新的pam認(rèn)證程序

vim/etc/pam.d/vsftpd1

auth  required   /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser

account  required   /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser

#vim /etc/vsftpd/vsftpd.conf

pam_service_name=vsftpd1

/etc/init.d/vsftpdrestart

登錄之后,出現(xiàn)這樣的問題:

226Transfer done (but failed to open directory).

修改配置文件:

vim/etc/vsftpd/vsftpd.conf

anon_world_readable_only=NO

額外的ftp配置:

vim/etc/vsftpd/vsftpd.conf

ftpd_banner=Welcometo uplooking ftp service

anon_max_rate=100  (單位是字節(jié))

max_clients=1

deny_file={*.ext,*.dll}

關(guān)于用戶訪問控制的兩個(gè)文件:

user_list

ftpusers

綜合練習(xí):

在一臺主機(jī)上創(chuàng)建三個(gè)基于域名的虛擬主機(jī),每個(gè)主機(jī)的磁盤配額為80M,90M,100M,使用ftp分別管理三個(gè)虛擬主機(jī),每個(gè)虛擬主機(jī)的管理員,只能管理自己的虛擬主機(jī)。要求,每個(gè)網(wǎng)站的磁盤具有高性能,高可靠性,并且可以磁盤擴(kuò)展。

  • ftp客戶端
  • ftp軟件下載
  • ftp服務(wù)器軟件下載
  • FTP上傳工具
ftp客戶端
(6)ftp客戶端

FTP是Internet上用來傳送文件的協(xié)議,通過它我們就能夠進(jìn)行各種文件的傳輸,一個(gè)穩(wěn)定且功能齊全的FTP客戶端工具能夠幫助大家節(jié)省大量的時(shí)間,特別是需要進(jìn)行各種大文件的傳輸操作的朋友,為了幫助大家,在這里小編給大家介紹一些好用的ftp客戶端,能夠便捷的進(jìn)行各種文件的傳輸操作。

...更多>>

擴(kuò)展知識

相關(guān)評論

閱讀本文后您有什么感想? 已有 人給出評價(jià)!

  • 2791 喜歡喜歡
  • 2101 頂
  • 800 難過難過
  • 1219 囧
  • 4049 圍觀圍觀
  • 5602 無聊無聊
熱門評論
最新評論
發(fā)表評論 查看所有評論(0)
昵稱:
表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)

ftp匿名用戶,虛擬用戶,配置文件參數(shù)含義

鏍囩锛� ftp