انجمنهای فارسی اوبونتو
کمک و پشتیبانی => شبکه و سرویس دهندهها => نویسنده: imohammad در 21 امرداد 1397، 02:00 بظ
-
سلام دوستان
من طبق این آموزش رو سرور اوبونتوییم ftp نصب کردم ولی اصلا نمیتونم بهش کانکت شم
همش تایم اوت میده
چکار کنم؟
https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-for-a-user-s-directory-on-ubuntu-18-04
-
دستورات زیر رو روی سرور FTP اجرا کنید و خروجیش رو قرار بدید:
sudo netstat -aepnut
sudo iptables -L -vn
sudo ifconfig
sudo route -n
-
دستورات زیر رو روی سرور FTP اجرا کنید و خروجیش رو قرار بدید:
sudo netstat -aepnut
sudo iptables -L -vn
sudo ifconfig
sudo route -n
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 19183 912/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 356 142.93.79.54:22 46.100.159.22:57648 ESTABLISHED 0 79783 4690/sshd: mohammad
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 0 23241 1398/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
udp 16896 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
sudo iptables -L -vn
Chain INPUT (policy DROP 975 packets, 52345 bytes)
pkts bytes target prot opt in out source destination
28204 5029K ufw-before-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
28204 5029K ufw-before-input all -- * * 0.0.0.0/0 0.0.0.0/0
1413 74809 ufw-after-input all -- * * 0.0.0.0/0 0.0.0.0/0
987 52829 ufw-after-logging-input all -- * * 0.0.0.0/0 0.0.0.0/0
987 52829 ufw-reject-input all -- * * 0.0.0.0/0 0.0.0.0/0
987 52829 ufw-track-input all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
0 0 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:40000
0 0 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:50000
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ufw-before-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-before-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-after-logging-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-reject-forward all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ufw-track-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 29 packets, 7028 bytes)
pkts bytes target prot opt in out source destination
29167 7320K ufw-before-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
29167 7320K ufw-before-output all -- * * 0.0.0.0/0 0.0.0.0/0
700 50932 ufw-after-output all -- * * 0.0.0.0/0 0.0.0.0/0
700 50932 ufw-after-logging-output all -- * * 0.0.0.0/0 0.0.0.0/0
700 50932 ufw-reject-output all -- * * 0.0.0.0/0 0.0.0.0/0
700 50932 ufw-track-output all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-after-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-input (1 references)
pkts bytes target prot opt in out source destination
2 156 ufw-skip-to-policy-input udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:137
0 0 ufw-skip-to-policy-input udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:138
1 52 ufw-skip-to-policy-input tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
423 21772 ufw-skip-to-policy-input tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
0 0 ufw-skip-to-policy-input udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:67
0 0 ufw-skip-to-policy-input udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:68
0 0 ufw-skip-to-policy-input all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCAST
Chain ufw-after-logging-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
Chain ufw-after-logging-input (1 references)
pkts bytes target prot opt in out source destination
951 50461 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
Chain ufw-after-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-after-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 3
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 4
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 11
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 12
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
0 0 ufw-user-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-before-input (1 references)
pkts bytes target prot opt in out source destination
2100 162K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
23211 4706K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
98 4762 ufw-logging-deny all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
98 4762 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 3
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 4
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 11
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 12
7 312 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
2788 155K ufw-not-local all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 udp dpt:5353
0 0 ACCEPT udp -- * * 0.0.0.0/0 239.255.255.250 udp dpt:1900
2788 155K ufw-user-input all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-before-logging-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-logging-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-before-output (1 references)
pkts bytes target prot opt in out source destination
2100 162K ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
26367 7107K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
700 50932 ufw-user-output all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-logging-allow (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW ALLOW] "
Chain ufw-logging-deny (2 references)
pkts bytes target prot opt in out source destination
98 4762 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID limit: avg 3/min burst 10
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
Chain ufw-not-local (1 references)
pkts bytes target prot opt in out source destination
2788 155K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type MULTICAST
0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCAST
0 0 ufw-logging-deny all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-reject-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-reject-output (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-skip-to-policy-forward (0 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-skip-to-policy-input (7 references)
pkts bytes target prot opt in out source destination
426 21980 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-skip-to-policy-output (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-track-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-input (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-track-output (1 references)
pkts bytes target prot opt in out source destination
511 30700 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 ctstate NEW
160 13204 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 ctstate NEW
Chain ufw-user-forward (1 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-input (1 references)
pkts bytes target prot opt in out source destination
1212 72380 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 /* 'dapp_OpenSSH' */
114 5888 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 /* 'dapp_Nginx%20HTTP' */
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:20
3 156 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
10 400 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 20,21,10000:10100
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:990
36 1440 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 40000:50000
Chain ufw-user-limit (0 references)
pkts bytes target prot opt in out source destination
0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 5 LOG flags 0 level 4 prefix "[UFW LIMIT BLOCK] "
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
Chain ufw-user-limit-accept (0 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain ufw-user-logging-forward (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-input (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-logging-output (0 references)
pkts bytes target prot opt in out source destination
Chain ufw-user-output (1 references)
pkts bytes target prot opt in out source destination
sudo ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 142.93.79.54 netmask 255.255.240.0 broadcast 142.93.79.255
inet6 fe80::645f:3cff:fef3:9385 prefixlen 64 scopeid 0x20<link>
ether 66:5f:3c:f3:93:85 txqueuelen 1000 (Ethernet)
RX packets 26462 bytes 5259374 (5.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 27291 bytes 7582666 (7.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2108 bytes 162686 (162.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2108 bytes 162686 (162.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 142.93.64.1 0.0.0.0 UG 0 0 0 eth0
10.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
142.93.64.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
-
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 19183 912/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 356 142.93.79.54:22 46.100.159.22:57648 ESTABLISHED 0 79783 4690/sshd: mohammad
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 0 23241 1398/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
udp 16896 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
دقت کنید سرویس vsftpd اجرا نیست.
دستورات زیر رو اجرا کنید و مجددا خروجیش رو قرار بدید:
sudo service vsftpd start
sudo service vsftpd status
-
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 19183 912/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 356 142.93.79.54:22 46.100.159.22:57648 ESTABLISHED 0 79783 4690/sshd: mohammad
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 0 23241 1398/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
udp 16896 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
دقت کنید سرویس vsftpd اجرا نیست.
دستورات زیر رو اجرا کنید و مجددا خروجیش رو قرار بدید:
sudo service vsftpd start
sudo service vsftpd status
بفرمایید
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 19183 912/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 0 142.93.79.54:22 115.238.245.4:59075 ESTABLISHED 0 93394 5986/sshd: root [pr
tcp 0 540 142.93.79.54:22 46.100.159.22:59016 ESTABLISHED 0 92251 5804/sshd: mohammad
tcp 0 0 142.93.79.54:22 115.238.245.4:42905 TIME_WAIT 0 0 -
tcp 0 0 142.93.79.54:22 46.100.159.22:58142 ESTABLISHED 0 82305 5106/sshd: mohammad
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 0 23241 1398/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
udp 35328 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
-
بفرمایید
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 19183 912/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 0 142.93.79.54:22 115.238.245.4:59075 ESTABLISHED 0 93394 5986/sshd: root [pr
tcp 0 540 142.93.79.54:22 46.100.159.22:59016 ESTABLISHED 0 92251 5804/sshd: mohammad
tcp 0 0 142.93.79.54:22 115.238.245.4:42905 TIME_WAIT 0 0 -
tcp 0 0 142.93.79.54:22 46.100.159.22:58142 ESTABLISHED 0 82305 5106/sshd: mohammad
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 0 23241 1398/vsftpd
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
udp 35328 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
عذر میخوام. من دقت نکردم. ظاهرا سرویس vsftpd روی آیپی ۶ فقط پورت باز میکنه.
لطفا خروجی زیر رو قرار بدید:
sudo cat /etc/vsftpd.conf
-
عذر میخوام. من دقت نکردم. ظاهرا سرویس vsftpd روی آیپی ۶ فقط پورت باز میکنه.
لطفا خروجی زیر رو قرار بدید:
sudo cat /etc/vsftpd.conf
بفرمایید
sudo cat /etc/vsftpd.conf
# Example config file /etc/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.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
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.
#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
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=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
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
-
sudo cat /etc/vsftpd.conf
# Example config file /etc/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.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
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.
#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
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=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
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
فایل vsftpd.conf رو با دستور زیر ویرایش کنید:
sudo nano /etc/vsftpd.conf
قسمت listen=NO رو به listen=YES تغییر بدید.
قسمت listen_ipv6=YES رو به listen_ipv6=NO تغییر بدید.
تغییرات رو با Ctrl+O ذخیره کنید و خارج بشید.
با دستور زیر سرویس رو ریستارت کنید.
sudo service vsftpd restart
خروجی زیر رو مجددا قرار بدید:
sudo netstat -aepnut
-
اگر سرویس بدون خطا ریستارت شد و پورت ۲۱ باز شده بود، مجددا اتصال رو امتحان کنید.
-
اگر سرویس بدون خطا ریستارت شد و پورت ۲۱ باز شده بود، مجددا اتصال رو امتحان کنید.
بازم وصل نمیشه
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 103703 8540/mysqld
tcp 0 0 0.0.0.0:42382 0.0.0.0:* LISTEN 0 414432 1363/ss-server
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 0 666669 19743/vsftpd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:16953 0.0.0.0:* LISTEN 0 415146 1552/ss-server
tcp 0 0 142.93.79.54:10010 0.0.0.0:* LISTEN 0 409125 32588/docker-contai
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 0 142.93.79.54:22 58.218.92.48:63418 ESTABLISHED 0 666969 19760/sshd: root [p
tcp 0 0 142.93.79.54:22 115.238.245.14:59677 ESTABLISHED 0 666936 19758/sshd: [accept
tcp 0 540 142.93.79.54:22 5.233.179.12:40682 ESTABLISHED 0 664720 19477/sshd: mohamma
tcp6 0 0 :::25771 :::* LISTEN 0 414554 1322/node
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51322 ESTABLISHED 0 418886 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50910 ESTABLISHED 0 418314 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51554 ESTABLISHED 0 420342 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50444 ESTABLISHED 0 416844 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50520 ESTABLISHED 0 416960 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50908 ESTABLISHED 0 418312 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51558 ESTABLISHED 0 420746 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50442 ESTABLISHED 0 416842 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51552 ESTABLISHED 0 420340 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51320 ESTABLISHED 0 418884 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50804 ESTABLISHED 0 418128 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50522 ESTABLISHED 0 416962 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51560 ESTABLISHED 0 420748 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51530 ESTABLISHED 0 419664 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51528 ESTABLISHED 0 419662 1322/node
udp 0 0 0.0.0.0:42382 0.0.0.0:* 0 414433 1363/ss-server
udp 52992 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
udp 0 0 0.0.0.0:16953 0.0.0.0:* 0 415147 1552/ss-server
udp 23808 0 127.0.0.1:61137 0.0.0.0:* 0 414400 1322/node
-
بازم وصل نمیشه
sudo netstat -aepnut
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 111 103703 8540/mysqld
tcp 0 0 0.0.0.0:42382 0.0.0.0:* LISTEN 0 414432 1363/ss-server
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 18676 895/nginx: master p
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 0 666669 19743/vsftpd
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 15151 649/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18487 856/sshd
tcp 0 0 0.0.0.0:16953 0.0.0.0:* LISTEN 0 415146 1552/ss-server
tcp 0 0 142.93.79.54:10010 0.0.0.0:* LISTEN 0 409125 32588/docker-contai
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 0 18678 895/nginx: master p
tcp 0 0 142.93.79.54:22 58.218.92.48:63418 ESTABLISHED 0 666969 19760/sshd: root [p
tcp 0 0 142.93.79.54:22 115.238.245.14:59677 ESTABLISHED 0 666936 19758/sshd: [accept
tcp 0 540 142.93.79.54:22 5.233.179.12:40682 ESTABLISHED 0 664720 19477/sshd: mohamma
tcp6 0 0 :::25771 :::* LISTEN 0 414554 1322/node
tcp6 0 0 :::80 :::* LISTEN 0 18677 895/nginx: master p
tcp6 0 0 :::22 :::* LISTEN 0 18495 856/sshd
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51322 ESTABLISHED 0 418886 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50910 ESTABLISHED 0 418314 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51554 ESTABLISHED 0 420342 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50444 ESTABLISHED 0 416844 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50520 ESTABLISHED 0 416960 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50908 ESTABLISHED 0 418312 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51558 ESTABLISHED 0 420746 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50442 ESTABLISHED 0 416842 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51552 ESTABLISHED 0 420340 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51320 ESTABLISHED 0 418884 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50804 ESTABLISHED 0 418128 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:50522 ESTABLISHED 0 416962 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51560 ESTABLISHED 0 420748 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51530 ESTABLISHED 0 419664 1322/node
tcp6 0 0 142.93.79.54:25771 2.185.39.243:51528 ESTABLISHED 0 419662 1322/node
udp 0 0 0.0.0.0:42382 0.0.0.0:* 0 414433 1363/ss-server
udp 52992 0 127.0.0.53:53 0.0.0.0:* 101 15150 649/systemd-resolve
udp 0 0 0.0.0.0:16953 0.0.0.0:* 0 415147 1552/ss-server
udp 23808 0 127.0.0.1:61137 0.0.0.0:* 0 414400 1322/node
ببخشید شما چطور اتصال رو تست میکنید؟!
روش سادش اینه که آیپی سرور رو با پروتوکل ftp تو مرورگر باز کنید:
ftp://142.93.79.54
برای من بدون مشکل باز میشه و درخواست نام کاربری و پسورد میکنه