관리 메뉴

웹개발자의 기지개

[Ubuntu] vsftpd 설치 본문

리눅스서버/Ubuntu

[Ubuntu] vsftpd 설치

http://portfolio.wonpaper.net 2023. 12. 2. 11:24

 

sudo apt-get update

sudo apt-get upgrade

 

ftp 설치하기

sudo atp-get install vsftpd

 

sudo systemctl status vsftpd  

실행됨을 확인한다.

 

환경설정파일 수정

sudo nano /etc/vsftpd.conf 

 

listen=NO
listen_port=9028

listen_ipv6=YES
anonymous_enable=NO

local_enable=YES
write_enable=YES


use_localtime=YES

xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log

connect_from_port_20=YES

chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
allow_writeable_chroot=YES


port_enable=YES
pasv_enable=YES

connect_from_port_20=YES
ftp_data_port=9027

pasv_min_port=30000
pasv_max_port=30010

userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO

 

패시브모드로 설정되어 있다.

 

다음으로


sudo nano /etc/vsftpd.chroot_list
sudo nano /etc/vsftpd.user_list

각각 파일을 만들고 한줄라인으로 접속자를 적어넣는다.

[ ftp 재가동 ]
sudo systemctl restart vsftpd


[ 방화벽 열기 ]

sudo ufw allow 9027:9028/tcp
sudo ufw allow 30000:30010/tcp


그런데, 해당 포트를 제거하려면 아래 형태와 같이 rule 제거후 삭제한다. 
sudo ufw deny 30000:30010/tcp
sudo ufw delete deny 30000:30010/tcp



[ 방화벽 재가동 ]

sudo ufw disable
sudo ufw enable



root@testubuntu:/etc# sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
Nginx HTTP                 ALLOW       Anywhere
9027:9028/tcp              ALLOW       Anywhere
30000:30010/tcp            ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
Nginx HTTP (v6)            ALLOW       Anywhere (v6)
9027:9028/tcp (v6)         ALLOW       Anywhere (v6)
30000:30010/tcp (v6)       ALLOW       Anywhere (v6)

 

 

root@dev:/home/dev# sudo ufw app list
Available applications:
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  OpenSSH

root@dev:/home/dev# sudo ufw allow 'Nginx Full'
Rule added
Rule added (v6)

root@dev:/home/dev# sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
9027:9029/tcp              ALLOW       Anywhere
30000:30010/tcp            ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
22                         ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
9027:9029/tcp (v6)         ALLOW       Anywhere (v6)
30000:30010/tcp (v6)       ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)

 

 

 

 

 

 

 

참고 : https://jjeongil.tistory.com/2086

참고 : https://samsons.tistory.com/61

 

 

 

Comments