Automated FTP without plaintext user/password in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automated FTP without plaintext user/password in script
# 1  
Old 09-15-2011
Automated FTP without plaintext user/password in script

hi , i am a still beginner in unix and specially in ftp i've written this script but my admin asked me that he don't want to see in my ftp neither user neither password , so i've created .netrc file where in it i've put machine name , user and pass but still included in my script , so if someone can see it to tell me who to remove my user and pass from the script to use it wthout them just automate it

the script is :
Code:
cd /tmp/FCDR_TEST
i=1
while [ $i -le 10 ]
do
  touch file$i
  i=`expr $i + 1`
done
HOST='x.y.z.u'
USER='user'
PASSWD='jajaja'
 
/usr/bin/ftp -i -n $HOST << EOF
quote USER $USER
quote PASS $PASSWD
cd /tmp/FCDR_TEST
lcd /export/home/user/tmp
mget file*
bye
EOF
rm /tmp/FCDR_TEST/file*


Last edited by Scott; 09-15-2011 at 04:25 AM.. Reason: Please use code tags
# 2  
Old 09-15-2011
use sftp ( need password less ssh setup -- google it or search in this forum )
# 3  
Old 09-15-2011
can u please just explain little bit more who to use it ???
# 4  
Old 09-15-2011
# 5  
Old 09-15-2011
thanks a lot , n i will try to find an escape

---------- Post updated at 12:45 PM ---------- Previous update was at 12:10 PM ----------

at my work we're not using yet SFTP , still of ftp so the problem can be resolved or ... ? hope not taking lot of ur time itkamaraj
# 6  
Old 09-15-2011
is your .netrc file having the permission 600 ?

Unix -> .netrc

---------- Post updated at 01:31 PM ---------- Previous update was at 01:30 PM ----------

Google Search Results for .netrc | The UNIX and Linux Forums
# 7  
Old 09-15-2011
yes n in it i've put machine x.x.x.x
login user
password xxxx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Encrypt Plaintext Password?

How do I encrypt a plaintext password that I need hardcoded in a bash script? (3 Replies)
Discussion started by: wyclef
3 Replies

2. Shell Programming and Scripting

Deleting local server file from automated FTP script

Hi, I want to delete a file on the local server, while connected to remote server through FTP. I am using the below code for this $FTP_CMD -v -n $HOST <<*! >> $LOGFILE 2>&1 user $USER $PASSWORD cd $DIR ... (11 Replies)
Discussion started by: jhilmil
11 Replies

3. Shell Programming and Scripting

Automated script to look for files in FTP Server location.

suppose one file comes in one sever location on MOnday.we have to write a script to automatically get that files and put it in different server location. ---------- Post updated at 10:28 AM ---------- Previous update was at 10:27 AM ---------- Please help me on this (2 Replies)
Discussion started by: sonam273
2 Replies

4. UNIX for Advanced & Expert Users

Automated SCP script passing password to preserve source file timestamp

Hi My requirement is i want to copy files from remote server to the local server and also i need to preserve the timestamp of the remote file. By using scp -p , it is working fine in the interactive call but it is not preserving he file timestamp when i use it in the non interactive scp call... (1 Reply)
Discussion started by: skumar75
1 Replies

5. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

6. Shell Programming and Scripting

Help needed with automated FTP script

Hi, Ok, i'm trying to automate sending a DB backup from a linux box to a remote Windows PC via FTP. I can connect, send the file and create a folder, however I require that the backups be differentiated by date. Here is what my script looks like: open *.*.*.* user username password lcd... (4 Replies)
Discussion started by: leimrod
4 Replies

7. Shell Programming and Scripting

ftp and user/password

I know the typical way to script automate an ftp session is to pass all of the commands to ftp, with something 'like' the following: echo USER $user echo PASS $pass My question concerns other methods or tricks people have used so that the username and ESPECIALLY the password are... (7 Replies)
Discussion started by: joeyg
7 Replies

8. UNIX for Advanced & Expert Users

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

9. Programming

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies

10. Shell Programming and Scripting

automated ftp script from unix -date range of files

Hi , I need some help to finish my ftp script and i need to find the last one weeks of fles updated in the sepecific directory and see those end with Z and ftp them to my backup server. Any help is appreciated. Thanks, Ravi :) (1 Reply)
Discussion started by: koduri0475
1 Replies
Login or Register to Ask a Question