基礎服務 FTP搭建及限制使用者用指定IP登入

2021-09-26 04:24:28 字數 3072 閱讀 1380

一、環境

一台centos7.5伺服器(搭建ftp檔案傳輸服務)

192.168.10.178

二、匿名訪問

1、安裝vsftpd服務

yum -y install vsftpd
2、建立ftp訪問目錄並賦權

# 建立ftp目錄

mkdir -pv /ftp/test

# 給訪問目錄賦權

chown -r ftp.ftp /ftp

chmod a-w /ftp

ll -d /ftp

ll /ftp/test

3、修改配置檔案

[root@localhost vsftpd]# cat vsftpd.conf

anonymous_enable=yes

local_enable=no

write_enable=yes

local_umask=022

anon_umask=022

anon_upload_enable=yes

anon_mkdir_write_enable=yes

anon_other_write_enable=yes

anon_root=/ftp

dirmessage_enable=yes

xferlog_enable=yes

connect_from_port_20=yes

xferlog_std_format=yes

listen=yes

listen_ipv6=no

pam_service_name=vsftpd

userlist_enable=yes

allow_writeable_chroot=yes

4、重啟ftp服務

systemctl restart vsftpd
get test

put test

三、使用者訪問

1、安裝vsftpd服務

yum -y install vsftpd
2、建立ftp訪問目錄並賦權

# 建立ftp目錄

mkdir /ftp

# 給目錄賦權

chown -r ftp.ftp /ftp/

# 檢視ftp目錄許可權

ll -d /ftp/

drwxrwxrwx 4 ftp

ftp 56 nov 28 02:33 /ftp/

3、修改配置檔案

[root@localhost vsftpd]

# cat vsftpd.conf |egrep -v "^$|^#"

anonymous_enable=no

local_enable=yes

write_enable=yes

allow_writeable_chroot=yes

local_umask=022

dirmessage_enable=yes

xferlog_enable=yes

connect_from_port_20=yes

xferlog_file=/var/log/xferlog

xferlog_std_format=yes

chroot_local_user=yes

listen_address=192.168.6.134

pam_service_name=vsftpd

local_root=/ftp

userlist_enable=yes

userlist_deny=no

4、重啟ftp服務

systemctl restart vsftpd
cat /etc/pam.d/vsftpd

session optional pam_keyinit.so force revoke

auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed

auth required pam_shells.so

auth include system-auth

account required pam_access.so

account include system-auth

session include system-auth

session required pam_loginuid.so

2、修改/etc/security/access.conf配置檔案

cat /etc/security/access.conf

-:test:all except 10.39.63.10

# - 為拒絕test使用者登入 except為除了10.39.63.10這個ip

# 意思為允許10.39.63.10使用test使用者登入

3、修改vsftpd.conf檔案

# 監聽位址些詳細位址有可能會報錯

cat vsftpd.conf |egrep -v "^$|^#"

anonymous_enable=no

local_enable=yes

write_enable=yes

local_umask=022

dirmessage_enable=yes

xferlog_enable=yes

connect_from_port_20=yes

xferlog_file=/var/log/xferlog

xferlog_std_format=yes

listen_address=192.168.6.134

pam_service_name=vsftpd

userlist_enable=yes

FTP服務搭建 ftp限制使用者

yum intstall y vsftpd systemctl start vsftpd vi etc vsftpd users.conf 此檔案為自己建立 zhang1 奇數行為賬號 0000 偶數行為密碼 zhang2 0000 轉化為berkeley db格式的資料庫檔案 db load t ...

用FileZilla搭建FTP伺服器及相關問題

在伺服器上安裝並配置服務端 安裝過程這裡不再贅述,一直下一步,在跳出彈窗時勾選 always connect to this server 然後點選 connect 即可 密碼可自行設定 之後提示資訊如下 問題與警告 解決方法 edit setting 或直接點選設定按鈕 齒輪 選擇 passive...

linux系統搭建ftp伺服器及建立使用者

linux 系統下搭建ftp伺服器 linux 系統下搭建ftp伺服器一點都不難,初次進行配置的時候花了很多時間進行linux命令掃盲,故寫下這篇部落格。環境 window作業系統中安裝securecrt 和 flashfxp 軟體 伺服器端的作業系統為centos7.3 在客戶端 使用secure...