I'm currently trying to send a file to an FTP server in Go utilizing the github.com/secsy/goftp library. I'm able to connect/authenticate against the server without issue, but I'm having trouble sending the file. There is not much context around the the error that I could find. I've tried manually forcing the client to use active and passive transfers without any success. Any ideas?
config := goftp.Config{
User: "username",
Password: "password",
ConnectionsPerHost: 1,
Timeout: 10 * time.Second,
IPv6Lookup: false,
ActiveTransfers: false,
Logger: os.Stderr,
}
client, err := goftp.DialConfig(config, "server_hostname:2121")
if err != nil {
fmt.Println("Error connecting to FTP")
fmt.Println(err.Error())
os.Exit(1)
}
uploadFile, err := os.Open(fileLocation)
if err != nil {
fmt.Println("Error opening file for FTP")
fmt.Println(err.Error())
os.Exit(1)
}
err = client.Store(ftpPath, uploadFile)
if err != nil {
fmt.Println("Error FTP'ing File")
fmt.Println(err.Error())
os.Exit(1)
}
Here are the messages posted from the client:
goftp: 0.000 #1 opening control connection to [server]:2121
goftp: 0.056 #1 sending command USER username
goftp: 0.084 #1 got 331-User name ok, password required
goftp: 0.084 #1 sending command PASS ******
goftp: 0.111 #1 got 230-Password ok, continue
goftp: 0.112 #1 sending command FEAT
goftp: 0.137 #1 got 211-211-Extensions supported:
goftp: 0.137 #1 was ready
goftp: 0.137 #1 sending command TYPE I
goftp: 0.137 #1 error reading response: short response: EPRT
Error FTP'ing File
error reading response: short response: EPRT
exit status 1
Here are the messages posted from the server:
2017/02/07 13:14:26 3c2634d4f643fe779c9a: Connection Established
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 220 Welcome to the Go FTP Server
2017/02/07 13:14:26 3c2634d4f643fe779c9a: USER username
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 331 User name ok, password required
2017/02/07 13:14:26 3c2634d4f643fe779c9a: PASS ****
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 230 Password ok, continue
2017/02/07 13:14:27 3c2634d4f643fe779c9a: FEAT
2017/02/07 13:14:27 3c2634d4f643fe779c9a: 211 211-Extensions supported:
EPRT
EPSV
211 END
2017/02/07 13:14:27 3c2634d4f643fe779c9a: TYPE I
2017/02/07 13:14:27 3c2634d4f643fe779c9a: 200 Type set to binary
2017/02/07 13:14:27 3c2634d4f643fe779c9a: Connection Terminated