If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > .netrc has two machine names with same name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-06, 13:10
Erik Alexander Erik Alexander is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
.netrc has two machine names with same name

I am having difficulties trying to figure out how to use the .netrc to login to a server where I already have the same server name for another ftp file.
For example, my .netrc would look like this:

machine 111.11.1.1 login idone password passone
machine 111.11.1.1 login idtwo password passtwo

When logging in with "idone" I am able to get to certain files, and when logging in with "idtwo" I am able to get to other files. The problem is that I cannot login with "idone" to get the "idtwo" files and visa-versa. When executing the script, it will obviously take the id and password of the first entry it comes to. Any thoughts?
Some other factors...I am using tlsftp to transfer these files. I have tried hardcoding the ftp command into my unix script (bypassing the .netrc file), but I keep getting errors. Unfortunatly my work installed tlsftp, but has no supporting documentation on it.
Any help you could provide would be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 02-23-06, 01:41
Bob4480 Bob4480 is offline
Registered User
 
Join Date: Feb 2004
Location: Los Angeles, CA
Posts: 28
You must use a unique "machine" name in the .netrc. Try using the domain name of the server as an alternate entry.

You can find it by doing an nslookup:

nslookup 207.46.250.119

will return something like this:

Name: microsoft.com
Address: 207.46.250.119

Then use that name in the .netrc file for one of your entries.

machine 207.46.250.119 login idone password passone
machine microsoft.com login idtwo password passtwo

Even though they both will go to the same place, you can use seperate logins for each since the machine name is different.

Last edited by Bob4480; 02-23-06 at 01:44.
Reply With Quote
  #3 (permalink)  
Old 02-23-06, 09:22
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
Edit your /etc/hosts to assign multiple hostnames to your server's ip address, then use those aliases as machine names in .netrc
Reply With Quote
  #4 (permalink)  
Old 02-23-06, 09:26
Erik Alexander Erik Alexander is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks Bob, I will give that a try and post back the results.
As a side note I also tried just putting the code into my unix script (by-passing the .netrc), but it doesn't like the standard code:
tlsftp -v << EOF
open 111.11.1.1
user idone passone
put filename
quit
EOF

Do you know if secure ftp works differently? I tried looking this up on the web but have not had any luck thus far.
Thanks for your help...any assistance anyone can provide on this would be greatly appreciated.
Reply With Quote
  #5 (permalink)  
Old 02-23-06, 09:59
Erik Alexander Erik Alexander is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
I received an error message "Verify Error CN=...type mismatch!" when trying to use the ip address. I will now request to have my /etc/hosts file name changed. I think this will prove promising since my sys admin's knew exactly what I was trying to do. I will post my progress.
Thanks for your assistance!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On