CentOSvsftp怎么安裝系統(tǒng)帳戶與配置文件

本篇內(nèi)容介紹了“CentOS vsftp怎么安裝系統(tǒng)帳戶與配置文件”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

創(chuàng)新互聯(lián)建站公司2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站建設(shè)、網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元望花做網(wǎng)站,已為上家服務(wù),為望花各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

一.安裝:

1.安裝CentOS vsftp服務(wù)相關(guān)部件:
[root@KcentOS5 ~]# yum install vsftpd*

2.確認(rèn)安裝PAM服務(wù)相關(guān)部件:
[root@KcentOS5 ~]# yum install pam*開(kāi)發(fā)包,其實(shí)不裝也沒(méi)有關(guān)系,主要的目的是確認(rèn)PAM。

3.安裝DB4部件包:
這里要特別安裝一個(gè)db4的包,用來(lái)支持文件數(shù)據(jù)庫(kù)。
[root@KcentOS5 ~]# yum install db4*

二.系統(tǒng)帳戶

1.建立CentOS vsftp服務(wù)的宿主用戶:

[root@CentOS5 /]#chmod 700 /home/vftpsite  [root@KcentOS5 ~]# useradd vsftpd -s /sbin/nologin

默認(rèn)的CentOS vsftp的服務(wù)宿主用戶是root,但是這不符合安全性的需要。這里建立名字為CentOS vsftp的用戶,用他來(lái)作為支持CentOS vsftp的服務(wù)宿主用戶。由于該用戶僅用來(lái)支持CentOS vsftp服務(wù)用,因此沒(méi)有許可他登陸系統(tǒng)的必要,并設(shè)定他為不能登陸系統(tǒng)的用戶。[root@CentOS5 /]#useradd –d /home/vftpsite –s /sbin/nologin vftpuser

2.建立CentOS vsftp虛擬宿主用戶:

[root@KcentOS5 nowhere]# useradd overlord -s /sbin/nologin本篇主要是介紹CentOS vsftp的虛擬用戶,虛擬用戶并不是系統(tǒng)用戶,也就是說(shuō)這些FTP的用戶在系統(tǒng)中是不存在的。他們的總體權(quán)限其實(shí)是集中寄托在一個(gè)在系統(tǒng)中的某一個(gè)用戶身上的,所謂CentOS vsftp的虛擬宿主用戶,就是這樣一個(gè)支持著所有虛擬用戶的宿主用戶。

由于他支撐了FTP的所有虛擬的用戶,那么他本身的權(quán)限將會(huì)影響著這些虛擬的用戶,因此,處于安全性的考慮,也要非分注意對(duì)該用戶的權(quán)限的控制,該用戶也絕對(duì)沒(méi)有登陸系統(tǒng)的必要,這里也設(shè)定他為不能登陸系統(tǒng)的用戶。

(這里插一句:原本在建立上面兩個(gè)用戶的時(shí)候,想連用戶主路徑也不打算給的。本來(lái)想加上 -d /home/nowhere 的,據(jù)man useradd手冊(cè)上講
述:“       -d, --home HOME_DIRThe new user will be created using HOME_DIR as the value for theuser鈙 login directory. The default is to append the LOGIN name to
BASE_DIR and use that as the login directory name. The directoryHOME_DIR does not have to exist but will not be created if it ismissing.

使用-d參數(shù)指定用戶的主目錄,用戶主目錄并不是必須存在的。如果沒(méi)有存在指定的目錄的話,那么它將不會(huì)被建立”。結(jié)果我嘗試 -d /home/nowhere 指定到一個(gè)并不存在的目錄的時(shí)候,我KAO!竟然給我自己新建了一個(gè)= =#)

三.調(diào)整CentOS vsftp的配置文件:

1.編輯配置文件前先備份
[root@KcentOS5 ~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.backup

2.編輯主配置文件Vsftpd.conf
[root@KcentOS5 ~]# vi /etc/vsftpd/vsftpd.conf

這里我將原配置文件的修改完全記錄,凡是修改的地方我都會(huì)保留注釋原來(lái)的配置。其中加入我對(duì)每條配置項(xiàng)的認(rèn)識(shí),對(duì)于一些比較關(guān)鍵的配置項(xiàng)這里我做了我的觀點(diǎn),并且原本英語(yǔ)的說(shuō)明我也不刪除,供參考對(duì)比用。

# 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_enable=NO

設(shè)定不允許匿名訪問(wèn)# Uncomment this to allow local users to log in.local_enable=YES設(shè)定本地用戶可以訪問(wèn)。注意:主要是為虛擬宿主用戶,如果該項(xiàng)目設(shè)定為NO那么所有虛擬用戶將無(wú)法訪問(wèn)。# Uncomment this to enable any form of FTP write command.
write_enable=YES設(shè)定可以進(jìn)行寫操作。

# 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

設(shè)定上傳后文件的權(quán)限掩碼。

#  # 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 anon_upload_enable=NO

禁止匿名用戶上傳。

# Uncomment this if you want the anonymous FTP user to be able to create  # new directories.  #anon_mkdir_write_enable=YES anon_mkdir_write_enable=NO

禁止匿名用戶建立目錄。

# Activate directory messages - messages given to remote users when they  # go into a certain directory.  dirmessage_enable=YES

設(shè)定開(kāi)啟目錄標(biāo)語(yǔ)功能。# Activate logging of uploads/downloads.xferlog_enable=YES設(shè)定開(kāi)啟日志記錄功能。# Make sure PORT transfer connections originate from port 20 (ftp-data).connect_from_port_20=YES設(shè)定端口20進(jìn)行數(shù)據(jù)連接。

# 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_uploads=NO

設(shè)定禁止上傳文件更改宿主。

#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

設(shè)定Vsftpd的服務(wù)日志保存路徑。注意,該文件默認(rèn)不存在。必須要手動(dòng)touch出來(lái),并且由于這里更改了CentOS vsftp的服務(wù)宿主用戶為手動(dòng)建立的CentOS vsftp。必須注意給與該用戶對(duì)日志的寫入權(quán)限,否則服務(wù)將啟動(dòng)失敗。# If you want, you can have your log file in standard ftpd xferlog formatxferlog_std_format=YES

設(shè)定日志使用標(biāo)準(zhǔn)的記錄格式。# You may change the default value for timing out an idle session.#idle_session_timeout=600設(shè)定空閑連接超時(shí)時(shí)間,這里使用默認(rèn)。將具體數(shù)值留給每個(gè)具體用戶具體指定,當(dāng)然如果不指定的話,還是使用這里的默認(rèn)值600,單位秒。# You may change the default value for timing out a data connection.#data_connection_timeout=120

設(shè)定單次***連續(xù)傳輸時(shí)間,這里使用默認(rèn)。將具體數(shù)值留給每個(gè)具體用戶具體指定,當(dāng)然如果不指定的話,還是使用這里的默認(rèn)值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 nopriv_user=vsftpd

設(shè)定支撐CentOS vsftp服務(wù)的宿主用戶為手動(dòng)建立的Vsftpd用戶。注意,一旦做出更改宿主用戶后,必須注意一起與該服務(wù)相關(guān)的讀寫文件的讀寫賦權(quán)問(wèn)題。比如日志文件就必須給與該用戶寫入權(quán)限等。

# 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

設(shè)定支持異步傳輸功能。

#  # 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

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

# You may fully customise the login banner string:  ftpd_banner=This Vsftp server supports virtual users ^_^

設(shè)定CentOS vsftp的登陸標(biāo)語(yǔ)。

#  # 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=NO

禁止用戶登出自己的FTP主目錄。

# (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 ls_recurse_enable=NO

禁止用戶登陸FTP后使用"ls -R"的命令。該命令會(huì)對(duì)服務(wù)器性能造成巨大開(kāi)銷。如果該項(xiàng)被允許,那么擋多用戶同時(shí)使用該命令時(shí)將會(huì)對(duì)該服務(wù)器造成威脅。

# 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=YES

設(shè)定該CentOS vsftp服務(wù)工作在StandAlone模式下。順便展開(kāi)說(shuō)明一下,所謂StandAlone模式就是該服務(wù)擁有自己的守護(hù)進(jìn)程支持,在ps -A命令下我們將可用看到vsftpd的守護(hù)進(jìn)程名。如果不想工作在StandAlone模式下,則可以選擇SuperDaemon模式,在該模式下 vsftpd將沒(méi)有自己的守護(hù)進(jìn)程,而是由超級(jí)守護(hù)進(jìn)程Xinetd全權(quán)代理,與此同時(shí),Vsftp服務(wù)的許多功能將得不到實(shí)現(xiàn)。

#  # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6  # sockets, you must run two copies of vsftpd whith two configuration files.  # Make sure, that one of the listen options is commented !!  #listen_ipv6=YES pam_service_name=vsftpd

設(shè)定PAM服務(wù)下CentOS vsftp的驗(yàn)證配置文件名。因此,PAM驗(yàn)證將參考/etc/pam.d/下的CentOS vsftp文件配置。userlist_enable=YES設(shè)定userlist_file中的用戶將不得使用FTP。tcp_wrappers=YES設(shè)定支持TCP Wrappers。

#KC: The following entries are added for supporting virtual ftp users.以下這些是關(guān)于CentOS vsftp虛擬用戶支持的重要配置項(xiàng)目。默認(rèn)Vsftpd.conf中不包含這些設(shè)定項(xiàng)目,需要自己手動(dòng)添加配置。guest_enable=YES設(shè)定啟用虛擬用戶功能。

guest_username=overlord指定虛擬用戶的宿主用戶。virtual_use_local_privs=YES設(shè)定虛擬用戶的權(quán)限符合他們的宿主用戶。user_config_dir=/etc/vsftpd/vconf設(shè)定虛擬用戶個(gè)人Vsftp的配置文件存放路徑。也就是說(shuō),這個(gè)被指定的目錄里,將存放每個(gè)Vsftp虛擬用戶個(gè)性的配置文件,一個(gè)需要注意的地方就是這些配置文件名必須和虛擬用戶名相同。保存退出。

“CentOS vsftp怎么安裝系統(tǒng)帳戶與配置文件”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

當(dāng)前名稱:CentOSvsftp怎么安裝系統(tǒng)帳戶與配置文件
本文地址:http://muchs.cn/article16/ihiggg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、動(dòng)態(tài)網(wǎng)站、關(guān)鍵詞優(yōu)化、網(wǎng)站設(shè)計(jì)公司網(wǎng)站改版、用戶體驗(yàn)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)