Hiding userid and password in ftp script

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
horserider
Participant
Posts: 71
Joined: Mon Jul 09, 2007 1:12 pm

Hiding userid and password in ftp script

Post by horserider »

I am running a ftp script as below and it works fine.

ftp -v -n abc.syscon.com
user adminuser login1q2w3e
lcd /company/user/shellscripts
put flatfile.txt flatfile.txt
put
bye

I am hardcoding the userid and password in FTP script. Anyway, to hide the userid/password in ftp script? Bascially I don't want to type the details, for other people to see (in case they get the ftp script)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't believe so - Google around and see what you can find out.

:idea: If you switch to a secure method, sftp or scp, and setup RSA keys you can perform the transfer without 'needing' a password.
-craig

"You can never have too many knives" -- Logan Nine Fingers
landaghaar
Participant
Posts: 38
Joined: Wed Sep 19, 2007 10:11 am
Location: Canada

Post by landaghaar »

Well you could create environment variables for userid and passwords in your .profile or create a .ftp file like this:


export USERID='the user id you want to use'
export PASSWD='your ftp password'


then in your ftp script just call this script by

. /full/path/to/.ftp
ftp -v -n abc.syscon.com
user $USERID $PASSWD
lcd /company/user/shellscripts
put flatfile.txt flatfile.txt
put

good enough?

but as chulett suggested, it is better to use sftp or scp, but only if the server supports it.
Post Reply