FTP를 접근하는데 기본적으로 필요한 것들
- vsftpd 서버
- vsftpd.conf 파일 설정
- 방화벽 설정
dnf install로 진행하기 때문에 소스 설치하는 방법을 보는 분들께는 적합하지 않음
# dnf -y install vsftpd
설치하면 /etc/vsftpd 경로에 설정파일들이 생성됨
먼저 나는 vim을 써서 vsftpd.conf 파일을 열었다
설정 파일 설명
11 # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
12 anonymous_enable=NO // 누구나 접속 가능하게 할지에 대한 여부 설정
13 #
14 # Uncomment this to allow local users to log in.
15 local_enable=YES // 로컬 유저 로그인 가능하게 할지에 대한 여부 설정
16 #
17 # Uncomment this to enable any form of FTP write command.
18 write_enable=YES // 로컬과 외부 접근 둘 다 쓰기 설정 여부
19 #
20 # Default umask for local users is 077. You may wish to change this to 022,
21 # if your users expect that (022 is used by most other ftpd's)
22 local_umask=022 // umask 값 설정, 이건 따로 포스팅 예정
23 #
24 # Uncomment this to allow the anonymous FTP user to upload files. This only
25 # has an effect if the above global write enable is activated. Also, you will
26 # obviously need to create a directory writable by the FTP user.
27 # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access
28 #anon_upload_enable=YES // 익명 사용자 업로드 허용 여부
29 #
30 # Uncomment this if you want the anonymous FTP user to be able to create
31 # new directories.
32 #anon_mkdir_write_enable=YES // 사용자 디렉터리 생성 허용 여부
33 #
34 # Activate directory messages - messages given to remote users when they
35 # go into a certain directory.
36 dirmessage_enable=YES
37 #
38 # Activate logging of uploads/downloads.
39 xferlog_enable=YES // 파일 전송 로그 남김 여부
40 #
41 # Make sure PORT transfer connections originate from port 20 (ftp-data).
42 connect_from_port_20=YES // standalone모드에서 ftp 포트 변경할 때 사용
/*
standalone모드와 inetd 모드가 있는데
standalone 모드는 listen=YES로 사용
-> vsftpd가 독립적으로 실행하며 항상 메모리를 점유하고 있음
-> 빠른 응답속도가 있지만 접근하는 클라이언트가 많다면 추천하지 않음
inetd 모드 (기본모드)
-> 필요한 경우에만 메모리를 점유함
-> 상대적으로 속도가 느리지만 접근 클라이언트가 많을 때 사용 추천
*/
52 xferlog_file=/var/log/xferlog // 로그파일명
53 #
54 # If you want, you can have your log file in standard ftpd xferlog format.
55 # Note that the default log file location is /var/log/xferlog in this case.
56 xferlog_std_format=YES // xferlog 표준 포맷 사용할지
57 #
58 # You may change the default value for timing out an idle session.
59 idle_session_timeout=600 // 유휴상태 타임아웃 시간
87 banner_file=/ftp/ftp.txt // 해당 경로에 파일 만들고 꾸미면 접근할 때 나옴
88 #
89 # You may specify a file of disallowed anonymous e-mail addresses. Apparently
90 # useful for combatting certain DoS attacks.
91 #deny_email_enable=YES
92 # (default follows)
93 #banned_email_file=/etc/vsftpd/banned_emails
94 #
95 # You may specify an explicit list of local users to chroot() to their home
96 # directory. If chroot_local_user is YES, then this list becomes a list of
97 # users to NOT chroot().
98 # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
99 # the user does not have write access to the top level directory within the
100 # chroot)
101 #chroot_local_user=YES
102 chroot_list_enable=YES // YES로 바꾸면 사용자가 자신의 홈 디렉터리 상단으로 가지 못함
// 만약 전체 사용자를 대상으로 하고 싶다면 위에 chroot_local_user 주석을 풀면됨
103 # (default follows)
104 chroot_list_file=/etc/vsftpd/chroot_list // 위의 사용자 홈 디렉터리 상단으로 가지 못하게 막는 유저 리스트
105 #
106 # You may activate the "-R" option to the builtin ls. This is disabled by
107 # default to avoid remote users being able to cause excessive I/O on large
108 # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
109 # the presence of the "-R" option, so there is a strong case for enabling it.
110 #ls_recurse_enable=YES
111 #
112 # When "listen" directive is enabled, vsftpd runs in standalone mode and
113 # listens on IPv4 sockets. This directive cannot be used in conjunction
114 # with the listen_ipv6 directive.
115 listen=NO // 위에 설명 써놓은 standalone 모드 변경 여부
116 #
117 # This directive enables listening on IPv6 sockets. By default, listening
118 # on the IPv6 "any" address (::) will accept connections from both IPv6
119 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
120 # sockets. If you want that (perhaps because you want to listen on specific
121 # addresses) then you must run two copies of vsftpd with two configuration
122 # files.
123 # Make sure, that one of the listen options is commented !!
124 listen_ipv6=YES
125
126 pam_service_name=vsftpd
127 userlist_enable=YES // enable을 YES로 해놓으면 user_list 파일에 명시해놓은 사용자만 접근 가능
128 userlist_deny=no // deny를 YES로 해놓으면 명시된 사용자 로그인 거부
나는 윈도우 클라이언트에서 테스트해봄
cmd
> ftp 10.10.10.10.
잘~~나온다
파일질라에서도 테스트 성공
'Linux > Rocky 8.10' 카테고리의 다른 글
[Rocky] firewall 아웃바운드 설정 (0) | 2024.09.02 |
---|---|
[Rocky] firewall 방화벽 설정 (0) | 2024.08.27 |
[Rocky] 유저 생성 및 디렉터리 자동 생성 (0) | 2024.08.22 |
[Rocky] SSH 포트 변경 (0) | 2024.08.21 |
[Rocky 8.10] PHPMYADMIN 설치 (0) | 2024.08.13 |