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)
Hiding userid and password in ftp script
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 71
- Joined: Mon Jul 09, 2007 1:12 pm
-
- Participant
- Posts: 38
- Joined: Wed Sep 19, 2007 10:11 am
- Location: Canada
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.
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.