[Tutor] How to handle passwords in programs that perform FTP processes?
Cameron Simpson
cs at cskk.id.au
Thu Jan 4 17:24:04 EST 2018
On 03Jan2018 20:20, boB Stepp <robertvstepp at gmail.com> wrote:
>Python 2.4, Solaris 10.
>
>I have several programs that must transfer files from our Solaris
>10-based intranet to our Windows-based intranet. They each have their
>own shell script to perform these file transfers, each customized for
>each program. Today I wrote a Python 2 program using the ftplib
>module that will replace all of these shell script programs and
>provide a standard interface for doing these transfers. It also will
>serve as a method for me to backup my programs on the Solaris 10-based
>intranet to a location on the Windows side. Even though these
>networks are supposed to be secure intranets where those who need to
>know know the generic user name and password for the FTP server, I
>would like to be as secure as possible with this information. How do
>I go about doing this? I am limited to whatever is available on the
>Solaris 10 operating system and it must work with Python 2.4 and its
>available standard libraries. I cannot use any outside software.
>However, I am free to write all the software I might like, assuming I
>can find time to do so. What would you sage Pythonistas recommend for
>my situation?
Look at the netrc module. Tradition ftp programs used to be able to use .netrc
files, and this module reads them. It means storing credentials in the clear
(obvious make the .netrc file 0600 permissions), but in most batch situations
you're stuck with that anyway.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Tutor
mailing list