CentOS8 搭建vsftpd伺服器

2022-08-18 09:42:12 字數 2945 閱讀 5651

開始搭建

1.檢查伺服器環境(是否安裝vsftpd服務並關閉防火牆和禁用selinux服務)

rpm -qa vsftpd && yum remove vsftpd

sed -i 's/selinux=enforcing/selinux=disabled/g' /etc/selinux/config

systemctl stop firewalld && systemctl disable firewalld

2.安裝vsftpd和db資料庫

yum install vsftpd-* pam* libdb-utils libdb* -y

3.建立虛擬使用者和賬戶密碼

useradd -s /sbin/nologin ftpuser

cd /home/ftpuser && mkdir test1 test2 && chown ftpuser.ftpuser -r test*

vim /etc/vsftpd/use_and_password
test1

123test2

123

db_load -t -t hash -f /etc/vsftpd/user_and_password /etc/vsftpd/vsftpd_login.db

chmod 700 vsftpd_login.db

#%pam-1.0

auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/

vsftpd_login

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 password-auth

account include password-auth

session required pam_loginuid.so

session include password-auth

anonymous_enable=

nolocal_enable=yes

write_enable=yes

local_umask=022

dirmessage_enable=yes

xferlog_enable=yes

connect_from_port_20=yes

xferlog_std_format=yes

listen

=yes

userlist_enable=yes

#######################配置虛擬使用者引數#################

guest_enable

=yes

guest_username=ftpuser    ##ftpuser為建立的虛擬使用者

user_config_dir=/etc/vsftpd/vsftpd_user_conf

virtual_use_local_privs=yes

pam_service_name=vsftpd

5.為每個vsftpd虛擬賬戶建立配置檔案

mkdir -p /etc/vsftpd/vsftpd_user_conf

cd /etc/vsftpd/vsftpd_user_conf

touch test1 test2

vim test1

local_root=/home/ftpuser/test1

write_enable=yes

anon_world_readable_only=yes

anon_mkdir_write_enable=yes

anon_upload_enable=yes

anon_other_write_enable=yes

6.設定鎖定訪問目錄許可權

anonymous_enable=no

local_enable=yes

write_enable=yes

local_umask=022

dirmessage_enable=yes

xferlog_enable=yes

connect_from_port_20=yes

xferlog_std_format=yes

listen=yes

userlist_enable=yes

guest_enable=yes

guest_username=ftpuser

pam_service_name=vsftpd

user_config_dir=/etc/vsftpd/vsftpd_conf

virtual_use_local_privs=yes

###########設定鎖定訪問目錄許可權######

local_root

=/home/ftpuser

chroot_list_enable=yes

chroot_list_file=/etc/vsftpd/user_and_password

allow_writeable_chroot=yes

7.開啟vsftpd服務

systemctl start vsfptd

搭建完畢。

Centos 8搭建Redis集群

總體來說,本地的redis搭建集群比較簡單,基本可以概括為 1.建立redis bin目錄副本 2.修改redis config配置 3.啟動所有節點 在 usr local 下建立redis cluster資料夾 mkdir usr local redis cluster將redis中的bin目錄...

Centos8搭建LANM環境

lnmp 環境是指在 linux 系統下,由 nginx mysql mariadb php 組成的 伺服器架構 參考nginx官網的安裝指導 1.向yum repository 新增nginx vim etc yum.repos.d nginx.repo 插入以下內容 nginx stable n...

VNC server 服務搭建(centos 8)

普通使用者的身份在遠端centos計算機上登入搭建。通常,伺服器未安裝桌面環境。如果您要連線的計算機沒有gui,則第一步是安裝它。否則,請跳過此步驟。執行以下命令在遠端計算機上安裝gnome centos 8中的預設桌面環境 sudo dnf groupinstall server with gui...