I have a Ubuntu 12.04 server set up with vsftpd.
I can ftp to it from a client like FileZilla without any problems.
When I do it from a script on another server(redhat) it gets permission denied. Why can Filezilla do this yet my script can't. Filezilla defaults to passive mode and logs in fine.
ftp_file.sh /home/arch/ /tmp/backup.tgz
Connected to xxx.xxx.xxx.xx (xxx.xxx.xxx.xx).
220 (vsFTPd 2.3.2)
331 Please specify the password.
230 Login successful.
250 Directory successfully changed.
local: /tmp/backup.tgz remote: /tmp/backup.tgz
227 Entering Passive Mode (xxx,xxx,xxx,xx,241,10).
550 Permission denied.
221 Goodbye.
Code:
HOST=xxx.xxx.xxx #This is the FTP servers host or IP address.
USER=adsdf #This is the FTP user that has access to the server.
PASS=###### #This is the password for the FTP user.
remote_dir=$1
file_name=$2
ftp -inv $HOST <<EOF
user $USER $PASS
cd $remote_dir
put $file_name
bye
EOF