본문 바로가기
걸어서 개발 속으로

CentOS ftp, sftp 서버 구축

by 손건호 2021. 9. 21.

접속자가 적은 홈서버 라 항상 자원이 남아 돌아서 활용할 부분을 생각해봤다

후에 개발에 사용할 이미지 url지원이나 동영상 자체 지원 서버를 만들어봤다

 

systemctl restart vsftpd

 

 

VSFTPD 설치
# yum -y install vsftpd

yum -y install vsftpd

 

VSFTPD 설정 파일
# vi /etc/vsftpd/vsftpd.conf

vi /etc/vsftpd/vsftpd.conf

 

 

=====================
anonymous_enable=YES ->NO
anon_upload_enable=YES -> NO
anon_mkdir_write_enable=YES ->NO

=============================

설정 후 필요에 따라 수정할 예정이다

 

패키지, 버전 정보 확인
# rpm -qa | grep vsftpd

rpm -qa | grep vsftpd

>> vsftpd-3.0.2-29.el7_9.x86_64

 

 

 

vsftpd status 확인

systemctl status vsftpd

● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 화 200000000000000 KST; 23h 50 min ago

 

 

 

서버 제시작 시 자동 시작 서비스 등록

systemctl enable vsftpd

 

 

서비스 등록 후 제시작

systemctl restart vsftpd

 

 

ftp 가 21 포트를 사용

netstat -tulpn | grep :21


tcp6       0      0 :::21                   :::*                    LISTEN      -

 

 

 

=================방화벽 등록====================
iptables 방화벽 목적 포트 21, XXX으로 연결 허용

# iptables -A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
# iptables -A INPUT -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
# iptables -A INPUT -p tcp --dport 20 -m state --state ESTABLISHED -j ACCEPT
# iptables -A INPUT -p tcp --dport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT

 

 

 

방화벽 서비스 등록

firewall-cmd --permanent --add-service=ftp

 

 

방화벽 리로드

firewall-cmd --reload

 

서비스 목록 보기

firewall-cmd --list-services

>> dhcpv6-client ftp http https ssh

 

 

++    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
#
# 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
#
# 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
#
# 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
#
"/etc/vsftpd/vsftpd.conf" 128L, 5113C

 

끝 

 

 

 

출처

 

https://sepiros.tistory.com/22

 

[CentOS 7] VSFTP 서버

 FTP 서버의 기본 기능이라 할 수 있는 파일 다운로드 및 업로드 설정하는 방법과 사용자 관리, SSH를 이용한 SFTP와 SSL/TLS를 이용한 안전한 FTPS 서버 구축까지 설명하겠다. FTP(File Transfer Protocol) 서

sepiros.tistory.com

 

 

https://server-talk.tistory.com/23

 

centos vsftpd 소개와 사용법

centos vsftpd 소개와 사용법 VSFTP란? vsftpd는 보안 부분을 특히 강조한 데몬으로 Redhat, Suse, Open-BSD에서 기본 FTP로 채택하고 잇으며 보안, 빠른 퍼포먼스, 안정성을 주요 특징으로 소개하고 있다. 또한

server-talk.tistory.com

 

댓글