Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  23] [ 0]  / answers: 1 / hits: 138352  / 2 Years ago, thu, september 29, 2022, 1:45:49

This is what I'm doing when I log into a FTP:



ftp user:password@server
ftp: user:password@server: Unknown host
ftp> echo HELLO WORLD!
ftp> quit


I'd like to do a one-line FTP command...



ftp user:password@server -command "echo HELLO WORLD"


or



"echo HELLO WORLD" | ftp user:password@server 


Something similar... as part of a script I'm trying to create. Nothing is getting transferred, I just need to echo some instructions and this is the easiest way I've found to do it between two of my systems.


More From » 10.10

 Answers
2

That really is more of a job for SSH (as others have pointed out), but if you're determined to use ftp, try lftp. It's freely available for all currently supported versions of Ubuntu. You can install it with the command sudo apt install lftp



lftp -u username,password -e "your command;quit" ftp.site.com


lftp documents a -c switch that runs the command and then quits, but it appears to be broken in most distributions. -e will keep you connected unless you issue a quit.


[#43496] Thursday, September 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
calronze

Total Points: 0
Total Questions: 110
Total Answers: 112

Location: Belarus
Member since Thu, Aug 11, 2022
2 Years ago
calronze questions
Sun, Jan 9, 22, 13:41, 2 Years ago
Wed, Feb 15, 23, 01:41, 1 Year ago
Sat, Jul 23, 22, 21:03, 2 Years ago
Sat, Feb 5, 22, 01:57, 2 Years ago
;