The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How transfer sql file from one serverto another without username and password Arpitmitm AIX 1 06-01-2008 03:52 AM
FTP Download username and password kumarrana UNIX for Dummies Questions & Answers 2 05-11-2008 09:45 PM
username password in script roshanjain2 Shell Programming and Scripting 5 02-13-2007 05:47 AM
setting username and password for ftp div UNIX for Advanced & Expert Users 1 12-08-2006 11:09 AM
redirecting password as username for rlogin seaten UNIX for Dummies Questions & Answers 1 05-12-2005 03:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-15-2008
nh1 nh1 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 4
Unhappy in ftp how to avoid username/password

hi all

i am very new to unix. we had the below scenior

test.bat file which contains

ftp -s:logfiles.scr servername

logfiles.scr contains

username
password

cd path
get file
bye

We had n number of batch(.bat files). which is having the same kind of scr file pointing same unix user. but getting different file
we dont know how to avoid the repeated username/pwd in all scr .

When we tried in a seperate scr for username/pwd. it is not login to unix.
like userid.scr
username
password

if anybody has the solution to keep username/pwd in a seperate file or parameter.

Pls give us with some example
  #2 (permalink)  
Old 07-15-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,311
I can't quite follow. Do you want to do ftps to many different hosts and get very different files from there or different hosts and always the same file from the same place or...

Nevertheless you might think of setting up ssh so you can do scp or sftp without big effort and encrypted too, if that's an option.

Else you should have a file or an array with a list of hostnames, loop it with for/do/done for example and call the ftp client with a here script, as a start.
  #3 (permalink)  
Old 07-15-2008
nh1 nh1 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 4
Hi

thank for reply.

Actually we had same host detail in all scr but getting different files from unix. instead of keeping host details(username/password) in all files. we would like to keep it in a separate file. once the username or pwd change we can change in a singlel file.

We are very know to unix.

using ftp we have to get unix files through scr.

Pls give some samples....that may help to us
  #4 (permalink)  
Old 07-15-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,585
Would .netrc not be an option?
  #5 (permalink)  
Old 07-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,311
You can write a file like:


Code:
host1 username password
host2 anothername passw0rd
...

Read that file with while/read and parse all 3 parameters into some ftp here-script.
What might be (if possible in your environment) better is using ssh and so with sftp/scp. You can just exchange the public keys and at least can leave out the usernames and PWs of the list; and it's also encrypted.
  #6 (permalink)  
Old 07-16-2008
nh1 nh1 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 4
could you pls some sample....

since that .bat file will run in the windows environment.
  #7 (permalink)  
Old 07-16-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,311
I am sorry, I have no knowledge of Windows Batch scripts. I could only give you an example in shell script.
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0