Tag Archives: FTP

FTP delete the directory and files, and there is a file deletion prompt under the directory [550 remove directory operation failed.]

Note: if there are files in the directory, deleting the directory directly will fail, and prompt 550 remove directory operation failed

You must delete all the files in the directory before deleting the directory

FTP command line:

FTP delete directory command:

rmdir Catalog Name

FTP delete file command:

delete File Name

operation in Python:

Delete directory command:

ftp.rmd(Catalog Name)

Delete file command:

ftp.delete(File Name)

An example of deleting a directory in python3 is as follows:

from ftplib import FTP
 
ftp = FTP(host=xx, user=xx, passwd=xx)
ftp.cwd(dirname)
for i in ftp.nlst():
    print(i)
    ftp.delete(i)
ftp.cwd("..")
ftp.dir()
ftp.rmd(dirname)

Note: because there are only files in my directory, there is no directory, so you can write like above. If there is a directory in your directory, you need to delete it recursively

How to Solve FTP Error: 426 Data connection closed, transfer abort…

426 data connection closed, transfer elevated solutions:

If the above error occurs during FTP connection, please check whether you have the following local settings:

1. Whether you have installed anti-virus software such as Norton on your computer, and if so, please turn it off temporarily
2. Whether you have used WinXP system, because WinXP system has its own firewall, if you use this system, please turn it off
3. If you are surfing the Internet on the intranet, Then, please check whether there are restrictions on high-end ports such as proxy server or hardware firewall in your software

Problems of entering extended passive mode encountered in FTP [How to Solve]

After logging into FTP on the AIX machine and entering the user name and password, the following problems are found

ftp> ls
229 Entering Extended Passive Mode (51374|)

To resolve this situation, ctrl+c and then type epsv4 off to enter.

ftp> epsv4 off
EPSV/EPRT on IPv4 off.
ftp> ls
227 Entering Passive Mode (9,44,51,77,147,2).
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 root system 256 Jul 28 22:21 dev

At first, I searched the Internet and said it was a problem with passvie mode, but after I entered passive, the result was as follows.

ftp> passive
Passive mode: off; fallback to active mode: off.
ftp> ls
200 EPRT command successful

Found that it still does not solve the problem</strong

Cause of failure: The default ftp client on suse linux is basically lukemftp, and after connecting, it appears that the directory cannot be listed, and it is unable to connect in PASV/PORT mode
229 Entering Extended Passive Mode (40862|)
After checking the compatibility of EPSV4 command, I found that
epsv4
Toggle the use of the extended EPSV and EPRT commands on IPv4 connections;
First try EPSV/EPRT, and then PASV/PORT. This is enabled by default.
If an extended command fails then this option will be temporarily disabled
If an extended command fails then this option will be temporarily disabled for the duration of the current connection, or until epsv4 is executed again.
Some older ftp servers have problems with EPSV/EPRT support, so you will need to perform epsv4 to disable these two commands.
Use the old command PASV/PORT to access

Searching for the difference between active and passive modes of ftp.


The difference between them is that when creating a data channel after connecting to the server.


PORT mode establishes a data connection from the server's high port to the client's port 20
PASV mode establishes a data connection from the client's high port to the data port returned by the server

The connection process in PORT (active) mode is: the client sends a connection request to the FTP port of the server (default is 21), the server accepts the connection and establishes a command link. When data needs to be transferred, the server sends a connection request from port 20 to the client's free port to establish a data link to transfer data.

The connection process of PASV (passive) method is: the client sends a connection request to the server's FTP port (default is 21), the server accepts the connection and establishes a command link. When data transfer is needed, the client sends a connection request to the server's free port and establishes a data link to transfer the data.

FTP only provides the ability to establish data communication over IPv4, which is based on the assumption that network addresses are 32 bits. However, with the advent of IPv6, addresses are much longer than 32 bits. The original extensions to FTP sometimes failed in a multi-protocol environment. The two FTP commands PORT and PASV have been extended for IPv6, and we call them EPRT and EPSV.

FTP upload file error: failure writing to local file

Original reference:

https://blog.csdn.net/stevendbaguo/article/details/52942594

https://www.cnblogs.com/linuxde/p/8719469.html

https://blog.csdn.net/zqtsx/article/details/24383755

In the process of using FTP, an error is reported in the FTP interface: 451 failure writing to local file and 227 entering passive mode

In fact, the fundamental problem is the first error, because when I checked the log, I found: SFTP server [10202]: error: process_ write: write failed

Generally speaking, there are two main reasons

(1) The disk is full

(2) The number of processes of the user has reached the limit, because the Linux system will limit the number of processes of each user in order to improve the utilization of system resources. You can use [ulimit – A] to view [ulimit – u 1-65535] to limit it

When connecting to FTP server, you will be prompted “500 oops: cannot change directory / home / xxx”

Baidu said that some of the results are changed configuration, changed a circle, the problem has not been solved, and finally by modifying the directory permissions to solve this problem

1. Modify directory access: sudo Chmod 755/home

2. Restart FTP service: Service vsftpd start

3. Accessing FTP in Windows

FTP connection error 530 permission denied solution

Linux system server, ready to use FileZilla connection, input IP address, root user, password, fast connection, error: 530 permission denied

Troubleshooting:

1. First, check whether the system has enabled the vsftp service. If not, start the service first

2. View the configuration of vsftpd. The configuration file defines the configuration of vsftpd user connection control

Vsftpd.ftpusers: located in/etc/vsftpd directory. It specifies which user accounts cannot access the FTP server, such as root

vsftpd.user_ List: in/etc/vsftpd directory. The user account in this file can’t access the FTP server by default, only if the userlist is enabled in the vsftpd. Conf configuration file_ Access is allowed only when enable = no option

Vsftpd.conf: located in/etc/vsftpd directory. From the definition of user login control, user rights control, timeout settings, server function options, server performance options, server response messages and other FTP server configuration

3. After configuration modification, execute service vsftpd restart to restart vsftpd service

If the FTP server is accessed by CMD or PowerShell, there is no following after reporting port command successful. Consider using PASV

How is 618 sales champion made?Uncover the secret of e-commerce’s “invigorating” hundreds of millions of sales data>>>

  1. Windows ftp client doesn’t supportPASVmode yet,so if you want to usePASVmode, you may need to change your ftp client, for example: filezilla

Windows FTP client does not support passive mode yet, so if you want to use active mode, you may need to replace your FTP client, for example: FileZilla
2. FTP active mode means FTP server will connect to FTP client when client get file from server

FTP activity mode is the mode that the FTP server connects to the FTP client when the client obtains the file from the server

So if you have this problem and you don’t want to change your windows ftp client, please try to

So if you encounter this problem and you don’t want to replace your Windows FTP client, please try
stop your Windows Firewall and then try FTP again, if it works, add a rule for Windows/system32/ftp.exit your firewall allow process list

Stop your Windows Firewall and try to connect to FTP again after that, and add a rule in the allowed process of the firewall for Windows/system32/ftp.exe

From & lt; https://blog.csdn.net/jiang__ jiang/article/details/52164426>

remarks:

The above content is from 2016. Although it is a little outdated, it still enlightens me. I set FTP in the firewall to allow TCP and UDP in both public and private network domains, and successfully log in to the FTP server that could not be used under windows before using other FTP terminals. In conclusion, I don’t know whether it’s the firewall, the FTP server line or the success of other FTP login. In a word, I successfully login with windows.

Good luck to you who didn’t succeed!

Solution of displaying 500 illegal port command in FTP

As everyone is away from home during the Chinese new year, they need to log in to FTP temporarily. Especially in the face of pneumonia in 2020, most of the employees work from home. But it’s very strange that the following mistakes have been made all the time

ftp>ls
500IllegalPORTcommand.
ftp:bind:Addressalreadyinuse
ftp>
ftp>dir
500IllegalPORTcommand.

 

At the beginning, I thought it was a network problem, but testing all kinds of situations failed. Then I checked the relevant information on the Internet and found that it was the problem of firewall setting. Solve the problem as follows

FTP commands on the LAN to access FTPSERVER on the external network, the execution of any command (such as dir,ls,put,get) always reports the following error
ftp:500IllegalPORTcommand.425
ftp:UsePORTorPASVfirst
Or the following error
ftp:500IllegalPORTcommand.
ftp:bind:Addressalreadyinuse
This is mainly because the Iptables firewall does not support
ip_nat_ftp
ip_conntrack_ftp
This can be solved by executing the following command on the ftp server in linux
modprobeip_nat_ftp
modprobeip_conntrack_ftp

By executing the above two commands and using active mode, the problem is solved

Original address:

Solution of displaying 500 illegal port command in FTP

Label:

ftp

modprobe

five hundred

 

 

Intelligent recommendation

Turn on NFS file system to improve the performance of vagrant shared directory

My Mac collection

ntpdate[16603]: the NTP socket is in use

[No.4 ionic] modify Cordova plug-in

Solutions to common errors in redis service

 

–Posted from Rpc

Node uses SSH2 SFTP Client to upload and download FTP files

Operating environment.

win7; node 10.15.1

The implementation steps are as follows

Step 1: Installation ssh2-sftp-client

npm install ssh2-sftp-client
// or
yarn add ssh2-sftp-client

Step 2: code implementation

 1 let Client = require('ssh2-sftp-client');
 2 
 3 function put(localPath, romotePath) {
 4     let sftp = new Client();
 5     sftp.connect({
 6         host: 'xx.xx.xx.xx', // Servers IP
 7         port: '22',
 8         username: 'xxxx',
 9         password: 'xxxxxx'
10     }).then(() => {
11         // upload
12         // return sftp.fastPut(localPath, romotePath);
13         // Download
14         return sftp.get(localPath, romotePath);
15     }).then((data) => {
16         // console.log(localPath + "Uploaded");
17         console.log(localPath + "Downloaded");
18         sftp.end();
19     }).catch((err) => {
20         console.log(err, 'catch error');
21     });
22 }
23 
24 let srcPath = 'D:\\MyDisk\\my-project\\node\\file\\test-copy.txt',
25     localPath = path.join(__dirname, 'test.txt'),
26     romotePath = '/home/xx/xx/webapps/xx/test.txt';
27 
28 // Upload file
29 // The first parameter is the local path of the file to be uploaded; the second parameter is the address where the server is stored
30 // put(localPath, romotePath);
31 // Download the file
32 // The first parameter is the address of the server where the file to be downloaded is stored; the second parameter is the local path
33 put(romotePath, srcPath);

note:

1. When uploading files, the fastput method is used, and the put method is used to upload files and report errors

2. SSH2 sfttp client official website document address