lftp: 로그인하고, 원격 디렉터리에 파일을 넣은 다음 단일 명령으로 종료합니다. 도움말을 올바르게 인용합니다.

lftp: 로그인하고, 원격 디렉터리에 파일을 넣은 다음 단일 명령으로 종료합니다. 도움말을 올바르게 인용합니다.

나는 한 번에 전체 세션을 수행하고 싶었고 lftp -c(나중에 스크립트를 통해 시작할 것이기 때문에) 성공했지만 -e종종 원하지 않는 대화형 세션이 남았습니다.

수동 상태

-c commands
          Execute the given commands and exit. Commands can be separated with a semicolon,  `&&'
          or  `||'.  Remember to quote the commands argument properly in the shell.  This option
          must be used alone without other arguments.

하지만 명령/상호작용을 올바르게 인용하고 연결하는 방법을 이해할 수 없습니다.

lftp -e "put -O remote/dir/ /local/file.txt" -u user,pass ftpsite.com 좋은 결과. 하지만 명령을 실행한 후에 종료하고 싶습니다.

lftp -c "open -u user,pass ftpsite.com" || put -O "remote/dir/ /local/file.txt" 그냥 나에게 소리치거나 실제로 내가 시도한 인용문의 조합( ||또는 &&무엇이든)

답변1

$ lftp -c "open -u user,pass ftpsite.com; put -O remote/dir/ /local/file.txt" 

그것은 이루어져야합니다.

그래도 문제가 해결되지 않으면 /etc/lftp.conf다음 줄을 추가해 보세요.

set ftp:ssl-protect-data true
set ftp:ssl-force true
set ftp:ssl-auth TLS
set ssl:verify-certificate no

답변2

lftp -e "put -O remote/dir/ /local/file.txt; bye" -u user,pass ftpsite.com

답변3

lftp -e "put -O remote/dir/ /local/file.txt; bye" ftp.yourhost.com

~/.netrc 아래에 자격 증명을 입력하세요.

machine ftp.yourhost.com login your_username password your_password

bash 기록을 제외하고는 업로드 중에 ps -aux를 사용할 때 읽을 수도 없기 때문에 cli에 비밀번호를 입력하는 것은 절대 금물입니다.

관련 정보