FTP Transfer Protocol 傳輸協議的縮寫。centos
FTP會話包含了兩個通道,一個叫控制通道,一個叫數據通道。瀏覽器
控制通道:控制通道是和FTP服務器進行溝通的通道,連接FTP,發送FTP指令都是經過控制通道來完成的。
數據通道:數據通道是和FTP服務器進行文件傳輸或者列表的通道。
FTP協議中,控制鏈接均有客戶端發起,而數據連接有兩種方式:PORT方式和PASV方式服務器
PORT模式(主動方式)網絡
PORT模式簡歷數據傳輸通道是由服務器端發起的,服務器使用20端口連接客戶端的某一個大於1024的端口。 FTP客戶端首先和FTP 服務端的tcp 21端口創建鏈接,經過這個通道發送命令,客戶端須要接受數據的時候在這個通道上發送PORT命令。PORT命令包含了客戶端
用什麼端口(大於1024 的端口)接受數據,在傳送數據的時候,服務器端經過本身的TCP 20 端口發送數據,FTP 服務端必須和客戶端創建一個新的連接來傳送數據。
客戶端使用1024以上的端口連接服務器的21號端口,而且會實現開啓一個1024+N的dua扣準備讓服務器來連接,服務器得知客戶端準備的端口後,用20號端口與客戶端連接,其中21號端口稱爲連接鏈路,20號端口稱爲數據鏈路,建立數據鏈路時server端處於主動連接客戶端的狀態,稱爲:主動傳輸模式。session
PASV模式(被動方式)app
PASV模式中,數據傳輸的通道的創建是由FTP客戶端發起的,他是用一個大於1024的端口連接服務器的1024以上的某一個端口。在創建控制通道的時候和PORT模式
相似,當客戶端經過這個通道發送PASV命令的時候,FTP server打開一個大於1024的隨機端口並進行數據的傳輸,這個時候FTP server 再也不須要創建一個新的
和客戶端之間的連接傳送數據。
客戶端使用1024以上的端口連接服務器端的21端口,服務器接到連接請求後,開啓一個1024+M的端口,等待客戶端來連接,在通知客戶端這個等待鏈接的端口號是1024+M,客戶端接到服務器端的信息後,開啓新的一個1024+N的端口與1024+M進行連接,其中21號端口爲鏈接鏈路,1024+M端口爲數據鏈路,建立數據連接時,server端處於被客戶端連接的狀態,因此稱爲:被動傳輸模式。dom
[root@localhost ~]# cat /etc/vsftpd/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 # 匿名用戶是否能夠訪問FTP # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir local_enable=YES # 本地用戶是否登陸 # # 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 # 本地用戶創建文件的權限 # # 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. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #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 # 容許匿名用戶建立新目錄 # # 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 # 主動模式傳輸使用20端口 # # 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/xferlog # 日誌文件位置 # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # 使用標準模式 # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # 空閒連接超時 # # You may change the default value for timing out a data connection. #data_connection_timeout=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 on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # 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(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=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 # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=NO # # This directive enables listening on IPv6 sockets. By default, listening # on the IPv6 "any" address (::) will accept connections from both IPv6 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6 # sockets. If you want that (perhaps because you want to listen on specific # addresses) then you must run two copies of vsftpd with two configuration # files. # Make sure, that one of the listen options is commented !! listen_ipv6=YES pam_service_name=vsftpd # 定義PAM所使用的名稱 userlist_enable=YES # user_list文件有效, tcp_wrappers=YES # 開啓tcp_wrappers支持 [root@localhost ~]#
首先安裝ftp:yum install ftp ,,,而後經過ftp便可在本地訪問socket
首先確保下面三項爲YESasync
anonymous_enable=YES anon_upload_enable=YES anon_mkdir_write_enable=YES
[root@localhost ~]# systemctl start vsftpd.service [root@localhost ~]# systemctl status vsftpd.service ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since 三 2018-09-12 11:12:50 CST; 1s ago Process: 57386 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 57388 (vsftpd) CGroup: /system.slice/vsftpd.service └─57388 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 9月 12 11:12:49 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon... 9月 12 11:12:50 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon. [root@localhost ~]#
NFS最初是由SUN公司開發的,目的就是在計算機不一樣操做系統之間能夠彼此共享文件,NFS配置簡單,快捷。客戶端能夠經過mount掛載以後像使用本地文件系統同樣來只用遠端共享目錄。tcp
在centos 7 上搭建NFS服務器比以往其實更加簡單,卸掉了protmap服務,而是用rpcbind服務。
/etc/exports 文件指定了那個文件系統的NFS應該輸出(有時候也能夠稱之爲「共享」)
/etc/exports 裏面每行指定一個輸出的文件系統和那些機器能夠訪問該文件系統。
在指定機器訪問權限的同時,訪問選項開關也能夠被指定。
/ect/export 格式:
共享目錄 主機1或ip1(選項1,選項2) 主機2或ip2(選項3,選項4)
主機名稱格式:
單個主機/IP:station1.uplooking.com 192.168.1.1 IP網絡: 192.168.1.0/255.255.255.0 172.16.1.0/15 通配符: *.uplooking.com
通常選項:
ro :read only rw :容許nfs read write 請求 sync:同步存儲後迴應請求 async:在同步以前回應請求
用戶ID映射:
root_squash :映射uid/gid 0 到匿名 uid/gid no_root_squash: 關閉root squashing all_squash:映射全部的uid/gid到匿名的uid/gid anonuid and anongid:映射uid/gid到指定的uid/gid
exportfs 命令用來管理當前NFS共享的文件系統列表。這個列表保存在一個單獨的文件/var/lib/nfs/etab中,當遠端主機要求對一個文件系統樹加載並訪問時由mountd讀取,列表中活動的一部分也保存在內核共享表中。一般etab在執行exportfs -a。的時候,根據/etc/exports中定義的共享列表來初始化。可是,管理員能夠選擇添加或者刪除獨立的文件系統,沒必要修改/etc/exports,只要執行exportfs就能夠了
-a:所有掛載(或卸載) /etc/exports 文件內的設定。 -r :從新掛載/etc/exports中的設置,此外同步更新/etc/exports以及/var/lib/nfs/etab中的內容 -u:卸載某一目錄 -v:在export時將共享的目錄顯示在屏幕上
[root@localhost ~]# exportfs -rv # 所有從新export一次 [root@localhost ~]# exportfs -au # 所有卸載 [root@localhost ~]#
。。。更多請移駕百度。。。
Samba,是一種自由軟件,用來讓Unix系列的操做系統與微軟Windows操做系統的SMB/CIFS網絡協議作聯結。
應用環境:
文件和打印機共享:文件和打印機共享是Samba的主要功能,SMB進程實現資源的共享,將文件和打印機發布到網絡之中,以供用戶能夠訪問。
身份驗證和權限設置:smbd服務支持user mode和domain mode等身份驗證和權限設置模式,經過加密方式能夠保護共享的文件和打印機。
名稱解析:Samba經過nmbd服務能夠搭建NBNS服務器,提供名稱解析,將計算機的NetBIOS名解析爲IP地址。
瀏覽服務:局域網中,Samba服務器能夠成爲貝蒂主瀏覽服務器(LMB),保存可用資源列表,當使用客戶端訪問Windows網上鄰居時,會提供瀏覽器列表,顯示共享目錄,打印機等資源
更多請百度。。等用到了再補充。。