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 > ftp without a username and password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-12-04, 13:51
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
ftp without a username and password

I have a server DEV1 which has some files that needs to be transferred via ftp to servers DEV2 and DEV3. The user performing the ftp on DEV1 is Mike and is logging into DEV2 and DEV3 as user Chug



I log in to DEV1 with the username called Mike. And as Mike, I issue the ftp command

ftp DEV2

I get

Enter PASSCODE at the Password: prompt.
230 User chug logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>



Thus, the user chug is automatically logged in without providing a username and password!! This is great and this is what I wanted on DEV3 also.


But to DEV3 (from DEV1), when I do the same -

ftp DEV3
I am asked for username and password -

(Here i can enter chug and its password, but i didn't want it to ask me for username and password). Is this something that can be set up on DEV3 so that from DEV1 when I say "ftp DEV3" user chug is logged in automatically

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 22:06
saurav101 saurav101 is offline
Registered User
 
Join Date: Oct 2003
Posts: 19
On machine DEV1 login using the id "mike" and go to the home directory .
Open the file called .netrc . If not there create one .
Inside that put the following :

machine <remote machine name> login <userid> password <password>

for e.g
machine DEV3 login chug password welcome

Save and exit from the file .

now on the command prompt try
ftp DEV3 ...
U should be able to log in to DEV3 as chug
Reply With Quote
  #3 (permalink)  
Old 04-17-04, 02:25
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Thanks a lot. That worked
Reply With Quote
  #4 (permalink)  
Old 05-26-04, 02:59
send2sridhar send2sridhar is offline
Registered User
 
Join Date: May 2004
Posts: 2
I followed the same steps but got an error

I followed the same steps but got an error 'Error - .netric file not correct mode. Remove passowrd or correct mode.' How to fix this up.
Reply With Quote
  #5 (permalink)  
Old 05-26-04, 09:34
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
~/.netrc != ~/.netric
Reply With Quote
  #6 (permalink)  
Old 05-26-04, 10:43
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Hello send2sridhar
Vgersh is right. The file should be .netrc and not .netric
and should be in your home directory
Reply With Quote
  #7 (permalink)  
Old 05-27-04, 13:20
fla5do fla5do is offline
Registered User
 
Join Date: Oct 2003
Location: Germany
Posts: 138
Quote:
Originally Posted by send2sridhar
I followed the same steps but got an error 'Error - .netric file not correct mode. Remove passowrd or correct mode.' How to fix this up.
set the permissions from the file "chmod 400 .netrc" (r--------)
__________________
Greetings from germany
Peter F.
Reply With Quote
  #8 (permalink)  
Old 06-03-04, 06:16
send2sridhar send2sridhar is offline
Registered User
 
Join Date: May 2004
Posts: 2
Its Worked!Thanks a Lot Mate

Its Worked!Thanks a Lot Mate . However there's a new problem, I am trying to write a shell script to run ftp process as a exe file. The problem is the commands r working fine in the unix mode but they r not working when the system enters ftp mode. Say this is the following code

ftp 10.80.20.38
bin
hash
prompt off
cd test
put
-------------------

I want to change the directory on the remote machine before putting the files there. However none of these commands work other than the ftp command, it logs me on to the remote machine(since I have enabled .netrc file), but thats it. I hope some body can help me.
Reply With Quote
  #9 (permalink)  
Old 06-03-04, 08:56
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
Code:
ftp 10.80.20.38 <<EOF
bin
hash
prompt off
cd test
mput *
EOF
Reply With Quote
  #10 (permalink)  
Old 06-07-04, 15:58
artemka artemka is offline
Registered User
 
Join Date: May 2004
Location: New York
Posts: 248
take a look at the man ftp look at the in flag
i beleve it is done something like this

ftp -in ipaddress <<EOF
username
password
cd directory
put or get
bye
EOF
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