1. 程式人生 > >python ftp 上傳文件出現 553 Could not create file

python ftp 上傳文件出現 553 Could not create file

報錯內容:

*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\r\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (10,65,252,38,254,125).\r\n'
*resp* '227 Entering Passive Mode (10,65,252,38,254,125).'
*cmd* 'STOR DODWAL0103920180507010001.AVL'
*put* 'STOR DODWAL0103920180507010001.AVL\r\n'
*get* '553 Could not create file.\r\n'
*resp* '553 Could not create file.'

553 Could not create file.

錯誤原因: 遠端路徑沒有許可權

ftp = ftpconnect("ip地址", "使用者名稱", "密碼",'遠端路徑')

下面為借鑑程式碼:源地址:https://blog.csdn.net/dingqingsong/article/details/44243651

  1. #-*- coding: utf-8 -*-  
  2. from ftplib import FTP    
  3. def ftpconnect():  
  4.     ftp_server = '10.***.***.**'#FTP server ip address
  5.     username = 'tom'
  6.     password = '*******'
  7.     timeout =30
  8.     port = 21
  9.     ftp=FTP()    
  10.     ftp.set_debuglevel(2)       #open debug level 2, can display detail message 
  11.     ftp.connect(ftp_server,port,timeout)  #connect to FTP server
  12.     ftp.login(username,password)     
  13.     return ftp    
  14. def downloadfile_from_FTP():  
  15.     ftp = ftpconnect()    
  16.     print
     ftp.getwelcome()    #can display FTP server welcome message.  
  17.     bufsize = 1024#set buffer size
  18.     remotepath = "\\Home\\product\\tom\\win7.iso"
  19.     localpath = 'D:\\tom\\win7.iso'
  20.     fp = open(localpath,"wb")   
  21.     ftp.retrbinary('RETR %s' % remotepath,fp.write,bufsize) #start to download file :FTP server --> local  
  22.     ftp.set_debuglevel(0# close debug 
  23.     fp.close()            #close connect  
  24.     ftp.quit()            #quit FTP server
  25. def uploadfile_to_FTP():  
  26.     ftp = ftpconnect()    
  27.     print ftp.getwelcome()   #can display FTP server welcome message.   
  28.     bufsize = 1024
  29.     remotepath = "\\Home\\product\\tom\\win8.iso"
  30.     localpath = 'D:\\system\\win8.iso'
  31.     fp = open(localpath,'rb')    
  32.     ftp.storbinary('STOR '+ remotepath ,fp,bufsize) #start to upload file :local --> FTP server
  33.     ftp.set_debuglevel(0)   # close debug
  34.     fp.close()              #close connect  
  35.     ftp.quit()              #quit FTP server
  36. if __name__ == "__main__":  
  37.     #downloadfile_from_FTP()
  38.     uploadfile_to_FTP()  

相關推薦

python ftp 出現 553 Could not create file

報錯內容:*cmd* 'TYPE I'*put* 'TYPE I\r\n'*get* '200 Switching to Binary mode.\r\n'*resp* '200 Switching to Binary mode.'*cmd* 'PASV'*put* 'PAS

vsftp檔案出現553 Could not create file解決方法

首先在ftp的目錄中建立一個目錄, 然後設定許可權為777 $ sudo mkdir /var/ftp/write $sudo chmod -R 777 /var/ftp/write 然後修改vsftp的配置檔案/etc/vsftpd.conf 檔案在最後新增上local_

ftp到hadoop的一個坑

hadoop執行如下命令,發現報錯[[email protected]/* */ ~]$ hadoop distcp ftp://ftp01:[email protected]/* *//test hdfs:///user/data Error: java.net.SocketExce

php出現500錯誤

pos buffer strong 需要 不可訪問 文件的 解決 ron 問題: 問題: 能上傳小於10k的文件,上傳大於10k的文件就會報500錯誤 解決辦法: 首先查看錯誤日誌,看看報錯是什麽 其次查看client_body_temp的權限問題 關於client_bod

Nginx配置(需要把nginx的根目錄指向ftp的目錄。)

上傳文件 nginx配置 技術分享 gin 分享 ges 指向 png -1 改成 Nginx配置(需要把nginx的根目錄指向ftp上傳文件的目錄。)

ftp不能到指定的

但是 沒有 ges brush image mod src 沒有權限 上傳 首先是,使用ftp創建連接,這一點沒有錯誤,但是在切換目錄創建文件夾的時候出現了問題。 指定創建的文件夾,總是創建失敗,切換目錄同樣失敗。最後查看文件夾的權限才知道,沒有權限的問題: 然後給img

FTP速度太慢怎麽辦?

FTP 文件傳輸 上傳文件 用戶在建設網站時必不可少的一類工具就是文件傳輸工具。通過客戶端和主機之間的文件交互,及時上傳補丁文件、下載日誌文件等,確保網站的正常穩定運行。但是也有不少用戶反映使用FTP上傳文件速度太慢,這是什麽原因呢?FTP上傳文件速度太慢怎麽辦?一、為什麽FTP上傳文件速度太慢?

ftp封裝

特殊字符 日誌 con dst share open xe8 \n 封裝 業務需求,頻繁傳遞圖片到對方ftp服務器,用此代碼可流式上傳文件。 上傳代碼 1 # coding:utf-8 2 import ftplib 3 import logging 4 impo

PHP使用FTP到服務器(實戰篇)

rename pri 根目錄 col pass 如果 pan lse class 我們在做開發的過程中,上傳文件肯定是避免不了的,平常我們的程序和上傳的文件都在一個服務器上,我們也可以使用第三方sdk上傳文件,但是文件在第三方服務器上。現在我們使用PHP的ftp功能把文件上

java FTP

nec let 有效 login cti tst reply 兩個 input 1.需要上傳文件至FTP,需要的jar包 <dependency> <groupId>commons-net</groupId>

Python requestsdemo

aid text b2c trac 2-2 pri oca .com eai #!/usr/bin/env python # -*- coding: utf-8 -*- import requests headers = {‘uuid‘: ‘5cb572b7-c0a

php - ftp 到遠程服務器

運行 acc 刪除 enc ref linux 所有權限 遠程 解決 ccentos7服務器 ======================== 一、安裝vsftpd及ftp命令 yum install vsftpd -y yum install ftp -y 二、v

FTP檔案報錯200 PORT command successful. Consider using PASV. 553 Could not create file.

一、背景最近搭好的在雲主機上搭好了nginx環境,打算通過ftp上傳一個靜態的網頁上去test一波,然後進去了ftp,在上面put了一下,結果沒有看到想象中上傳成功的樣子,看到的是200 PORT command successful. Consider using PASV

vsftp553 Could not create file錯誤解決

搭建一個ftp伺服器,我使用Centos 7作業系統,安裝好vstfpd,建立了使用者等操作。在Windows客戶端可以正常的連線,但是當上傳檔案時,總是報553 Could not create file錯誤資訊。 試了網上的各種許可權方法都不行,如果確定讀寫修改都有了,那就是selinux限

linux中ftp提示--553 Could not create file

col 阿裏 nbsp pre log 原因 ould eat span 今天在阿裏雲的linux上搭建ftp服務的時候,搭建成功之後,上傳文件時總提示553 Could not create file,找了半天原因,終於解決了 ftp主目錄為/home/myftp ch

FTP報錯 553 Could not create file

  因工作需要,需要搭建一個ftp伺服器,我使用ubuntu 10.04作業系統,下載vsftpdy原始碼,進行了編譯,安裝,然後按照INSTALL檔案,建立了使用者等操作。    因為時間比較緊,我採用匿名使用者,進行檔案的上傳測試。修改了/etc/vsftpd.conf

linux中ftp提示--553 Could not create file (絕對有用)

提示553 Could not create file,把這個目錄的屬主和許可權都設定好,還是報這個錯誤,那仔細在網上查查,問題解決如下:   錯誤提示   當前目錄是/home  ftp> !ls -l  ......  -rwxr-xr-x   1 root 

vsftpd的配置說明,以及553 Could not create file.錯誤的解決

      VSFTP檔案與目錄       /usr/sbin/vsftp      vsftp的主程式       /etc/rc.d/init.d/vsftp          vsftp的啟動指令碼       /etc/vsftpd/vsftpd.conf        vsftp的配置

[Linux] CentOS vsftp 553 Could not create file 錯誤解決

症狀:使用者可以從遠端伺服器登入ftp,可以檢視ftp各種路徑檔案,但是不能上傳,上傳提示553 Could not create file.查看了各種資料夾許可權,都設定沒問題,最後發現是SELinu

ftp

shell#!/bin/bash HOST=192.168.1.107 USER=anonymous PASSWD=anonymous FTP_DIR=/pub ftp -i -v -n << EOF open $HOST user $USER $PASSWD cd $FTP_DIR mput s