Troubleshooting Common Wput Errors and FixesWput is a command-line tool used to upload files to FTP and HTTP servers, often favored for its simplicity and scripting-friendly behavior. Like any network tool, it can encounter errors due to configuration issues, network problems, server settings, or user mistakes. This article covers frequent Wput errors, explains what causes them, and provides step-by-step fixes and preventive tips.
1. Installation and basic verification
Before troubleshooting specific errors, confirm Wput is correctly installed and accessible.
-
Check version and availability:
wput --version
If the command is not found, install via your package manager:
- Debian/Ubuntu:
sudo apt update sudo apt install wput
- Fedora:
sudo dnf install wput
- macOS (Homebrew):
brew install wput
- Debian/Ubuntu:
-
Basic connectivity test: Try uploading a small test file to a known working FTP/HTTP endpoint to isolate whether the issue is Wput-specific or network/server-related:
echo "test" > test.txt wput test.txt ftp://username:[email protected]/path/
2. Authentication failures (530, 401)
Symptoms: Server responds with errors like 530 Login incorrect (FTP) or 401 Unauthorized (HTTP).
Causes:
- Wrong username or password.
- Special characters in credentials causing shell or URL parsing issues.
- Account restrictions on the server (disabled user, expired password, IP restrictions).
- Using the wrong protocol (e.g., sending FTP credentials to an HTTP endpoint that expects different auth).
Fixes:
- Verify credentials by logging in with an FTP client (FileZilla, lftp) or using curl:
curl -u username:password ftp://ftp.example.com/
- URL-encode special characters in username/password. For example, replace “@” with “%40”. Example:
wput file.txt ftp://user%40example.com:pa%[email protected]/
- Use Wput’s interactive mode to avoid shell parsing issues:
wput -u username -p password file.txt ftp://ftp.example.com/path/
- Check server-side account status with the hosting provider or server admin.
3. Connection refused or timeout errors
Symptoms: Messages like Connection refused, Connection timed out, or prolonged hanging.
Causes:
- Server is down or not listening on the expected port.
- Firewall blocking outbound or inbound connections.
- Incorrect hostname or port.
- Network issues (DNS failures, routing problems).
Fixes:
- Confirm server hostname and port:
nc -vz ftp.example.com 21
or for HTTP(S):
nc -vz example.com 80 nc -vz example.com 443
- Test with curl or a browser to verify the endpoint is reachable:
curl -I http://example.com/
- If DNS issues are suspected, try using the server’s IP address:
wput file.txt ftp://user:[email protected]/path/
- Check local firewall/iptables and corporate network policies. Temporarily disable local firewall for testing:
sudo ufw status sudo ufw disable # testing only
- If the server uses a non-standard port, include it in the URL:
wput file.txt ftp://user:[email protected]:2121/path/
4. Permission denied / file system errors on server (550)
Symptoms: FTP returns 550 Permission denied or File not found.
Causes:
- The target directory does not exist.
- Permissions on server-side directory or file prevent writing.
- Chrooted FTP user with restricted path.
- Server-side disk quota exceeded.
Fixes:
- Verify the path exists and is writable. Connect with an FTP client to list directories:
wput --listing ftp://user:[email protected]/
- Create the target directory or upload to a permitted location:
wput --mkdir file.txt ftp://user:[email protected]/new/path/
Note: Some servers don’t support automatic mkdir via FTP; you may need to create directories separately.
- Check server disk usage and quotas; free space if necessary.
- Contact server admin to ensure the account has write permissions.
5. Transfer interrupted or incomplete uploads
Symptoms: Uploads stop mid-way, partial files on server, or CRC/checksum mismatches.
Causes:
- Unstable network or transient connection drops.
- Server limits on transfer size or timeouts.
- Wput configuration not using resume where supported.
Fixes:
- Enable resume/retry options if available. Wput supports resuming some uploads using the –resume option:
wput --resume largefile.iso ftp://user:[email protected]/path/
- Use smaller chunks or split large files before upload:
split -b 100M largefile.iso part_ wput part_* ftp://user:[email protected]/path/
- Increase server and client timeout settings where configurable.
- Retry with exponential backoff via a loop in a shell script:
#!/bin/bash for i in {1..5}; do wput file.txt ftp://user:[email protected]/path/ && break sleep $((i * 10)) done
6. SSL/TLS and certificate errors
Symptoms: Errors mentioning SSL, TLS, certificate verification failure, or protocol mismatch.
Causes:
- Server presents a self-signed or expired certificate.
- Wput (or underlying libcurl/openssl) refuses insecure connections by default.
- Server expects FTPS or explicit TLS but client is using plain FTP.
Fixes:
- Verify what protocol the server expects (FTP, FTPS explicit, FTPS implicit, SFTP—note wput does not support SFTP).
- Use the correct URL scheme: ftps:// for implicit FTPS or ftp:// with TLS options for explicit TLS if supported.
- If using a self-signed certificate and you accept the risk, allow insecure connections via curl/lib options if wput exposes them. If no direct flag exists, consider wrapping with lftp or curl, which provide explicit –insecure flags.
- Update CA certificates on the client:
- Debian/Ubuntu:
sudo apt install --reinstall ca-certificates sudo update-ca-certificates
- Debian/Ubuntu:
- Check and renew expired server certificates.
7. Incorrect URL encoding or special characters issues
Symptoms: Server errors complaining about path not found or unexpected behavior when filenames contain spaces or special characters.
Causes:
- Spaces or shell-special characters not escaped or URL-encoded.
- Using quotes incorrectly so shell still interprets characters.
Fixes:
- URL-encode spaces as %20 or wrap the URL in single quotes:
wput 'my file.txt' ftp://user:[email protected]/'path with spaces'/
- Encode special characters in filenames:
- Space -> %20
- # -> %23
- ? -> %3F
- Alternatively, change to a safe filename before upload.
8. Passive vs Active FTP mode problems
Symptoms: Data connection errors, directory listing failures, or successful control connection but transfer failures.
Causes:
- Network or NAT/firewall issues where the server cannot establish a data connection back to the client (active mode).
- Server firewall blocking passive ports.
Fixes:
- Switch between passive and active FTP modes. Wput defaults to passive in many setups; if you need active mode, pass the appropriate option if available or use another client like lftp which provides clear flags:
wput --passive file.txt ftp://user:[email protected]/
If wput lacks the needed switch, use lftp:
lftp -e "set ftp:passive-mode off; put file.txt; bye" -u user,pass ftp://ftp.example.com
- Ensure server’s passive port range is configured and firewall rules allow it.
9. Redirects and HTTP upload issues
Symptoms: HTTP uploads fail when server returns redirects (⁄302) or expects multipart/form-data instead of PUT.
Causes:
- Using the wrong HTTP method: servers commonly expect POST with multipart/form-data; PUT may be disabled or redirected.
- Server returns redirect to another host or URL.
Fixes:
- Verify server’s required method. If it expects POST multipart form uploads, use curl or a script:
curl -F '[email protected]' https://example.com/upload
- If relying on HTTP PUT and server redirects, follow redirects by using a client that follows them or check server configuration to accept direct PUT where appropriate.
- Use correct headers and authentication as required by the web API.
10. Verbose logging and debugging
When troubleshooting, increasing verbosity helps identify where the problem occurs.
- Run Wput with verbose or debug flags (if supported):
wput -v file.txt ftp://user:[email protected]/
- Capture network traffic with tcpdump or Wireshark to see underlying protocol exchanges:
sudo tcpdump -i any host ftp.example.com and port 21 -w wput-debug.pcap
- Use strace to inspect system calls if you suspect local environment issues:
strace -o wput-strace.log wput file.txt ftp://user:[email protected]/
11. Alternatives when Wput lacks features
If Wput cannot handle a required scenario (SFTP, advanced TLS options, complex multipart HTTP), consider alternatives:
Tool | Strengths |
---|---|
curl | Flexible HTTP(S), FTP, supports multipart POST, detailed TLS options |
lftp | Advanced FTP features, scripting, active/passive control, mirror support |
sftp/ssh | Secure file transfer over SSH (SFTP) |
rsync over SSH | Efficient sync and resume over SSH |
12. Preventive tips and best practices
- Test uploads with small files first.
- Use URL-encoding for credentials and filenames with special characters.
- Keep CA certificates and client libraries updated.
- Prefer secure protocols (FTPS or SFTP) whenever possible.
- Script retries and resumptions for large files.
- Monitor server logs when possible to correlate client errors with server responses.
If you share a specific wput command and the exact error output you’re seeing, I can provide a targeted fix and the exact command adjustments to resolve it.
Leave a Reply