ftpサーバーへ接続

shell
# 致命的エラー: gnutls_handshake: An unexpected TLS packet was received.
#  解決案:

[root@server ~]# lftp -u user,pass -p 21 ftp://sample.jp
lftp user@sample.jp:~> set ftp:ssl-auth TLS
lftp user@sample.jp:~> set ftp:ssl-force true
lftp user@sample.jp:~> set ftp:ssl-allow yes
lftp user@sample.jp:~> set ftp:ssl-protect-list yes
lftp user@sample.jp:~> set ftp:ssl-protect-data yes
lftp user@sample.jp:~> set ftp:ssl-protect-fxp yes
lftp user@sample.jp:~> set ssl:verify-certificate no
lftp user@sample.jp:~> set cmd:fail-exit yes
lftp user@sample.jp:~>
lftp user@sample.jp:~> ls
drwxrws---    6 3003     3003         4096 Jul 26  2017 a
lftp user@sample.jp:/>bye
[root@server ~]# 

 ftpサーバーへファイル転送

shell
# shell.sh ファイル転送shell

retcode=0
lftp -c "DEBUG -o /var/www/html/log/`date '+%Y%m%d%H%M%S'`'.log'; \
      set ftp:ssl-force true; \
      set cmd:fail-exit yes; \
      set ftp:ssl-auth TLS; \
      set ssl:verify-certificate no; \
      set ftp:ssl-allow yes; \
      set ftp:ssl-protect-list yes; \
      set ftp:ssl-protect-data yes; \
      set ftp:ssl-protect-fxp yes; \
      open -p $port $host; \
      user $username $password; \
      put $srcfilepath -o $dstfilepath; " 2>&1
if [[ ${?} -ne 0 ]]; then
    echo `date` " [ERROR] 転送失敗" | tee -a '/var/www/html/log/'`date '+%Y%m%d'`'.log'
    retcode=1
else
    echo `date` " [INFO] 転送完了" | tee -a '/var/www/html/log/'`date '+%Y%m%d'`'.log'
fi
exit ${retcode}

参考
致命的エラー: gnutls_handshake

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.