Ways to encrypt password,username,ip adddress when ftp files from local to remote server ?

General support questions
Post Reply
huangxinying
Posts: 9
Joined: 2021/08/25 06:29:09

Ways to encrypt password,username,ip adddress when ftp files from local to remote server ?

Post by huangxinying » 2021/10/20 05:14:31

Hi

I'm working on a script which used to transfer encrypted mysql db files from local centos7.9 into remote ftp server using ftp . but I do not way to wirte ftp password,username,ip address directly in this script ,do I have any way to enrypt them ? thanks a lot !

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Ways to encrypt password,username,ip adddress when ftp files from local to remote server ?

Post by jlehtone » 2021/10/20 09:09:24

First, FTP is not very secure. Doesn't it pass password over net in cleartext? How about rsync or sftp, which both use SSH?

If you have data stored in the script encrypted, then the script has to decrypt the data during runtime. For that it needs a password during runtime. Do you prefer to write the password of ftp server, or the decrypt key for encrypted password of ftp server? (As example, Ansible has encrypted "Vaults" for sensitive data and can copy files over network -- with ssh.)

If you have someone in the machine that has the script, then they can watch connections and processes easier than read the file. Getting the IP, and possibly username, should be trivial.

Some programs/scripts read password from separate file or environment variable. SSH can read activated token from socket that ssh-agent is set to listen and similarly Gnome has its keymanager process.

Whoever
Posts: 1357
Joined: 2013/09/06 03:12:10

Re: Ways to encrypt password,username,ip adddress when ftp files from local to remote server ?

Post by Whoever » 2021/10/21 05:48:20

huangxinying wrote:
2021/10/20 05:14:31
Hi

I'm working on a script which used to transfer encrypted mysql db files from local centos7.9 into remote ftp server using ftp . but I do not way to wirte ftp password,username,ip address directly in this script ,do I have any way to enrypt them ? thanks a lot !
Don't do this. Use "rsync -e ssh" or sftp and authenticate using public/private key pairs.

Post Reply