I have a functioning, automated FTP script that I have previously verified as functional, but as of today, when running the script, the machine is recognizing the username input, but not the password, giving the following output (reduced to show problem only):
331 User name okay, need password.
530 not logged in
For some reason, it's reading the command to pipe the username, but not the password, even though they are exactly the same, and in consecutive lines.
If it's worth anything, the file is saved on the machine's desktop, and I usually navigate to the directory through cd ~/Desktop
Here's the code, any help at all is appreciated:
#!/bin/bash
HOST=example.mydomain.com
USER=user
PASS=pass
cd source/directory
ftp -inv $HOST << EOF
quote USER $USER
quote PASS $PASS
cd target/directory
put sampleFile.gz
exit
EOF
EDIT: I have seperately tried to ftp manually through ftp example.mydomain.com
and the credentials are still correct.
USER
environment variable that you are overwriting with your script. Some shells also has aHOST
variable (notbash
, butzsh
has). This is unlikely the cause of your issue unlessftp
uses those environment variables internally (I don't think it does).-A
but you should check your manual. If active mode works, then I still wouldn't see that as a "solution" but rather as a "workaround".