26.02.2018, 05:38 (This post was last modified: 26.02.2018, 05:38 by phongvucba.)
Hi everybody !
I have this code to save the backup file to the NAS service (using the ftp protocol). On the Lm3 (I use version 20170424), I opened the ftp service (login successful)
On nas synology, i open ftp service (login successful, full privileges for fpt_user directory).
When running the script on LM3 it again error as shown below:
"string: 553 <fpt_user> LM_nha_mau_HN-2018.02.26_12-28.tar.gz: Permission denied."
Have you met this case yet? And where is the error?
Please help me !
Thank so much!
Have you checked with another FTP client if you can upload files to this account? Also check that you can upload to root folder, or only to a specific folder. You might have to adjust path in FTP upload script on LM.
Thank admin !
I use script:
------------------
---------------
--Take a backup and ftp to NAS
-- name of backup file
src = 'LM_nha_mau_HN-' .. os.date('%Y.%m.%d_%H-%M') .. '.tar.gz'
-- where to put backup file on LM
dst = '/home/ftp/' .. src
-- where to put the backup on NAS
target = '<fpt_user>' .. src
-- prepare files for backup
os.execute('sh /lib/genohm-scada/web/general/backup.sh')
-- backup the config and transfer it to the nas
function backup()
log("System Backup: started")
--Take a backup and ftp to NAS
-- name of backup file
src = 'backup-' .. os.date('%Y.%m.%d_%H-%M') .. '.tar.gz'
-- where to put backup file on LM
dst = '/home/ftp/' .. src
-- where to put the backup on NAS
target = FTP_TARGET_FOLDER .. src
-- prepare files for backup
os.execute('sh /lib/genohm-scada/web/general/backup.sh')
-- ftp to NAS
log("System Backup: transfering backup to NAS, host:" .. FTP_TARGET_IP .. ", target:" .. target)
res, err = socket.ftp.put({
host = FTP_TARGET_IP,
user = FTP_TARGET_LOGIN,
password = FTP_TARGET_PW,
secure = true,
datasecure = true,
type = "i",
argument = target,
source = ltn12.source.file(io.open(dst, "rb")) })
if (err) then
logMsg = "System Backup: failed with error:"
if (error) then
logMsg = logMsg .. err
else
logMsg = logMsg .. "nil"
end
if (res) then
logMsg = logMsg .. ", result:" .. res
else
logMsg = logMsg .. ", result:nil"
end
log(logMsg)
alert("System Backup: failed, could not ftp to NAS, host:" .. FTP_TARGET_IP .. ", target:" .. target)
alert(logMsg)
end