當前位置:首頁 » 文件傳輸 » linux怎麼修改本地ftp
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

linux怎麼修改本地ftp

發布時間: 2023-02-03 01:25:22

Ⅰ 如何在linux中設置ftp用戶名和密碼

一、啟動vsftpd服務
1、 啟動VSFTP伺服器
A:cenos下運行:yum install vsftpd
B. 登錄Linux主機後,運行命令:」service vsftpd start」
C. 要讓FTP每次開機自動啟動,運行命令: 「chkconfig --level 35 vsftpd on」

二、設置FTP許可權

A. 編輯VSFTP配置文件,運行命令:」vi /etc/vsftpd/vsftpd.conf 「

B. 將配置文件中」anonymous_enable=YES 「改為 「anonymous_enable=NO」

C. 保存修改,按ESC鍵,運行命令:「:wq」這樣關閉了匿名登錄功能。

三、添加用戶:
A. 登錄Linux主機後,運行命令:」useradd ftpadmin -s /sbin/nologin 「。該賬戶路徑默認指向/home/ftpadmin目錄;如果需要將用戶指向其他目錄,請運行命令:useradd ftpadmin -s /sbin/nologin _d /www(其他目錄)

B. 設置ftpadmin用戶密碼,運行命令:」passwd ftpadmin」 ; 輸入兩次密碼,匹配成功後,就設置好了ftpadmin用戶的密碼了。

C.測試連接,您可以在「我的電腦」地址欄中輸入 ftp://IP 來連接FTP伺服器,根據提示輸入賬戶密碼。

Ⅱ linux中創建的ftp怎麼修改配置保存配置

如果是使用VI打開文件,修改完成後,可以使用VI中的命令:wq!直接保存,也可以使用:shift+z進行保存。一般的配置文件如果修改了,都需要保存。

Ⅲ linux如何重新配置FTP文件,我是新手,配置的時候被我弄錯了!

那就可以重新生成配置文件,可以用yum源 yum remove vsftp -y 卸載後,重新在安裝一下,就可以了
下面是:Linux FTP配置文件說明

一.vsftpd說明:
LINUX下實現FTP服務的軟體很多,最常見的有vsftpd,Wu-ftpd和Proftp等.Red Hat Enterprise Linux中默認安裝的是vsftpd.
訪問FTP伺服器時需要經過驗證,只有經過了FTP伺服器的相關驗證,用戶才能訪問和傳輸文件.vsftpd提供了3種ftp登錄形式:
(1)anonymous(匿名帳號)
使用anonymous是應用廣泛的一種FTP伺服器.如果用戶在FTP伺服器上沒有帳號,那麼用戶可以以anonymous為用戶名,以自己的電子郵件地址為密碼進行登錄.當匿名用戶登錄FTP伺服器後,其登錄目錄為匿名FTP伺服器的根目錄/var/ftp.為了減輕FTP伺服器的負載,一般情況下,應關閉匿名帳號的上傳功能.
(2)real(真實帳號)
real也稱為本地帳號,就是以真實的用戶名和密碼進行登錄,但前提條件是用戶在FTP伺服器上擁有自己的帳號.用真實帳號登錄後,其登錄的目錄為用戶自己的目錄,該目錄在系統建立帳號時系統就自動創建.
(3)guest(虛擬帳號)
如果用戶在FTP伺服器上擁有帳號,但此帳號只能用於文件傳輸服務,那麼該帳號就是guest,guest是真實帳號的一種形式,它們的不同之處在於,geust登錄FTP伺服器後,不能訪問除宿主目錄以外的內容.

二.FTP相關配置文件說明
其相關配置文件有/etc/vsftpd/vsftpd.conf, /etc/vsftpd.ftpusers, /etc/vsftpd.user_list,在配置FTP伺服器時,主要是修改這些文件中的相關語句.
1.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 //是否允許anonymous登錄FTP伺服器,默認是允許的.
#
# Uncomment this to allow local users to log in.
local_enable=YES //是否允許本地用戶登錄FTP伺服器,默認是允許
#
# 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 //設置本地用戶的文件生成掩碼為022,默認是077
#
# 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
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES //是否允許匿名賬戶在FTP伺服器中創建目錄
#
# 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 //啟用FTP數據埠的連接請求
#
# 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/vsftpd.log //設置日誌文件的文件名和存儲路徑,這是默認的
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES//是否使用標準的ftpd xferlog日誌文件格式
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600 //設置空閑的用戶會話中斷時間,默認是10分鍾
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120//設置數據連接超時時間,默認是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 turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#ascii_upload_enable=YES
#ascii_download_enable=YES //是否允許使用ASCII格式來上傳和下載文件
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.//在FTP伺服器中設置歡迎登錄的信息.
#
# 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=YES,那麼只允許/etc/vsftpd.chroot_list中列出的用戶具有該功能.如果希望所有的本地用戶都執行者chroot,可以增加一行:chroot_local_user=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
pam_service_name=vsftpd //設置PAM認證服務的配置文件名稱,該文件存放在/etc/pam.d/目錄下.
userlist_enable=YES //用戶列表中的用戶是否允許登錄FTP伺服器,默認是不允許
#enable for standalone mode
listen=YES //使vsftpd 處於獨立啟動模式
tcp_wrappers=YES //使用tcp_wrqppers作為主機訪問控制方式
2.vsftpd.ftpusers文件說明
這個文件是用來記錄"不允許"登錄到FTP伺服器的用戶,通常是一些系統默認的用戶.
下面是該文件中默認的不允許登錄的名單:
# Users that are not allowed to login via ftp
root //默認情況下,root和它以下的用戶是不允許登錄FTP伺服器的.可以將不允許登錄的用戶添加到這里來.但切記每個用戶都要單獨佔用一行.
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
3.vsftpd.user_list文件說明
其實它的內容跟上面那個文件內容一樣,只是在系統對文件vsftpd.conf 進行檢測時,會檢測到"userlist_deny=YES",因此這個文件必須存在.下面是這個文件的內容.
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd.ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody

Ⅳ linux ftp伺服器 如何修改配置文件

配置文件在:/etc/vsftpd/vsftpd.conf
參數
作用

listen=[YES|NO]
否以獨立運行的方式監聽服務。

listen_address=IP地址
設置要監聽的IP地址。

listen_port=21
設置FTP服務的監聽埠。

download_enable=[YES|NO]
是否允許下載文件。
userlist_enable=[YES|NO]
userlist_deny=[YES|NO]
是否啟用「禁止登陸用戶名單」。
max_clients=0
最大客戶端連接數,0為不限制。
max_per_ip=0

同一IP地址最大連接數,0位不限制。
anonymous_enable=[YES|NO]
是否允許匿名用戶訪問。
anon_upload_enable=[YES|NO]
是否允許匿名用戶上傳文件。
anon_umask=022

匿名用戶上傳文件的umask值。
anon_root=/var/ftp
匿名用戶的FTP根目錄。
anon_mkdir_write_enable=[YES|NO]
是否允許匿名用戶創建目錄。
anon_other_write_enable=[YES|NO]
是否開放匿名用戶其他寫入許可權。
anon_max_rate=0
匿名用戶最大傳輸速率(位元組),0為不限制。
local_enable=[YES|NO]
是否允許本地用戶登陸FTP。
local_umask=022

本地用戶上傳文件的umask值。
local_root=/var/ftp
本地用戶的FTP根目錄。
chroot_local_user=[YES|NO]

是否將用戶許可權禁錮在FTP目錄,更加的安全。
local_max_rate=0

本地用戶最大傳輸速率(位元組),0為不限制。

Ⅳ linux系統中怎樣配置ftp

Linux下配置VSftp伺服器步驟一、檢查是否安裝了vsftpd, rpm -qa |grep vsftp

Linux下配置VSftp伺服器步驟二、新建用戶

useradd test -g root -d /mpeg -s /sbin/nologin #該用戶僅用來支持FTP服務,因此不必讓他登錄系統

註:改變用戶的shell命令為usermod -s /sbin/nologin coship

Linux下配置VSftp伺服器步驟三、設置密碼

passwd test # 連續輸入兩次密碼

Linux下配置VSftp伺服器步驟四、修改SELinux參數

setsebool ftpd_disable_trans 1

service vsftpd restart

說明:如果不修改,連接時會提示

500 OOPS: cannot change directory:/mpeg

500 OOPS: child died

Linux下配置VSftp伺服器步驟五、修改/mpeg許可權

chmod 775 /mpeg

Linux下配置VSftp伺服器步驟六、設置/etc/vsftpd/vsftpd.conf

將anonymous_enable=NO,這樣可以限制匿名用戶登錄。

local_enable=YES #啟用本地用戶登錄

write_enable=YES #設置可以進行寫操作

local_umask=022 #設定上傳後文件的許可權掩碼

userlist_enable=YES #啟用用戶登錄控制

local_root=/mpeg (路徑自定義)#定義所有本地用戶的根目錄。當本地用戶登入時,將被更換到此目錄下。(注釋則訪問該用戶自己目錄)

否則訪問其它目錄時會提示:550 Failed to change directory.

chroot_local_user=NO

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list #指出被鎖定在自家目錄中的用戶的列表文件。文件格式為一行一用戶。

注意:

當chroot_local_user=NO、chroot_list_enable=YES時,chroot_list中用戶為鎖定用戶,即他們除了自己的目錄,不可以訪問其他目錄。

當chroot_local_user=YES、chroot_list_enable=YES時,chroot_list中用戶為非鎖定用戶,他們可以訪問任何其他目錄。

Linux下配置VSftp伺服器步驟七、設置vsftpd自動啟動

chkconfig vsftpd on 或

運行ntsysv將vsftpd選上 或

echo "/usr/local/sbin/vsftpd &" >>/etc/rc.local

Linux下配置VSftp伺服器步驟八、如果出現不能訪問的現象可以將防火牆和SELinux停用

1、service iptables stop

2、編輯/etc/selinux/config將SELINUX設為disabled,即SELINUX=disabled

或終端里運行system-config-securitylevel-tui

或點擊「system"->"administration"->"security level and firewall對防火牆和SELinux進行設置

Ⅵ Linux中如何通過命令修改FTP伺服器的默認目錄

這個要看你使用的是什麼驗證,如果默認使用的驗證就是本地驗證的話,你可以先使用 添加用戶的方法來進行比如新建一個用戶 useradd -d /var/ftp/zuoye zuoye passwd zuoye 把許可權變成755把.最主要是 zuoye的擁有者要為 zuoye可以使用 chmod 755 /var/ftp/zuoye 修改許可權 chown zuoye.zuoye /var/ftp/zuoye 這樣你把你的vsftp安裝好。使用身份驗證登陸。。然後重新啟動服務,使用zuoye進行登陸即可在自己的家目錄下, 如果你想所有用戶都要登陸在這里的話,需要修改 /etc/vsftpd/vsftpd.conf 文件。你說的 /var/ftp 一般都是 覓名用戶默認登錄點

Ⅶ Linux中如何通過命令修改FTP伺服器的默認目錄

這個要看你使用的是什麼驗證,如果默認使用的驗證就是本地驗證的話,你可以先使用
添加用戶的方法來進行比如新建一個用戶
useradd
-d
/var/ftp/zuoye
zuoye
passwd
zuoye
把許可權變成755把.最主要是
zuoye的擁有者要為
zuoye可以使用
chmod
755
/var/ftp/zuoye
修改許可權
chown
zuoye.zuoye
/var/ftp/zuoye
這樣你把你的vsftp安裝好。使用身份驗證登陸。。然後重新啟動服務,使用zuoye進行登陸即可在自己的家目錄下,
如果你想所有用戶都要登陸在這里的話,需要修改
/etc/vsftpd/vsftpd.conf
文件。你說的
/var/ftp
一般都是
覓名用戶默認登錄點