in ftp how to avoid username/password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting in ftp how to avoid username/password
# 8  
Old 07-16-2008
One way is to create the FTP parameter file in the Windows Batch Script. You can then have whatever parameters you like. In this example all four variables which could change are command line parameters.
Important: I don't know which Windows version you have, but in my experience the "-n" parameter on the ftp command line MUST be present if you want to autologin to work! Also the username and password are on the same line and preceded by the word "user".
Hope this solves your problem.


REM ftptest3.bat
REM parameter driven ftp with autologin
REM
REM Save parameters with meaningful names
set X_FILE=%1
set X_USER=%2
set X_PASS=%3
set X_SERV=%4
REM
REM Create parameter file for ftp
echo user %X_USER% %X_PASS% > ftptest3.inp
echo ascii >> ftptest3.inp
echo get %X_FILE% >> ftptest3.inp
echo quit >> ftptest3.inp
REM
REM Transfer the file
ftp -n -s:ftptest3.inp %X_SERV%
# 9  
Old 07-18-2008
i have tried like

created
1.ftptest3.bat it contains only unix details
2.transfer file test.bat it contains
call ftptest3.bat
ftp -n -s:ftptest3.inp %X_SERV%

When i run test.bat i gave commandline arguments like filename,username,pwd servername.
But it is not connected.

Actually we are trying like the above steps. instead of giving username and pwd in each and every bat file. we have to keep it in a separate file.(ftptest3.bat).we will include that file in each bat file .

Could you pls give me some suggestion
# 10  
Old 07-18-2008
You are mixing your environments. .bat files are Windows ONLY.

(ftptest3.bat it contains only unix details) -Clarification is required. Anyway, why re-invent the wheel?

http://www.howtogeek.com/howto/windo...-command-line/

and for Unix/Linux:
http://www.mavetju.org/unix/netrc.php

Google is your friend.
# 11  
Old 07-18-2008
I humbly suggest that if you are concerned with security, there are much better alternatives. SSH is how folks commonly do secure transfers, specifically with "scp". You can create certificates for authentication between machines. This avoids the cleartext FTP problem and elevates your posture significantly. As "scp" is inherently line-based, it works well for transfers such as what you speak of. If, that is, I understand your needs.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do you reset username/password

Picked up a 3b2 running System V. Works fine, but it requires a username and password. Is the username "root" or "sysadm"? How do I find out and how to I reset it or bypass it? Thanks. (2 Replies)
Discussion started by: TanRuNomad
2 Replies

2. Shell Programming and Scripting

Username and password

Hi I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Discussion started by: somersetdan
5 Replies

3. Shell Programming and Scripting

loop picks up password for 2 entry...how to avoid that ?

hello all, i am trying to find a better to do what i am doing right now... i have a file called sidlist...which has my database_name and password to the respective database so something like below.. file is called sidlist and entry is below... test, abc123 kes12, abcd12 pss, abcd1234... (5 Replies)
Discussion started by: abdul.irfan2
5 Replies

4. Shell Programming and Scripting

FTP command line username and password passing

Dear All, I am new to unix and I am trying to build a shell script which will connect to a different server by passing username and password from a file or command line but not manually... In short I dont want to connect to a diff server via ftp interactively. Any suggestion...looking... (8 Replies)
Discussion started by: Pratik4891
8 Replies

5. UNIX for Dummies Questions & Answers

How can i hide username/password

hi all, i run sqlplus command on unix(HP-UX) like "sqlplus username/password@serverA @deneme.sql" but when someone run "ps -ef | grep sqlplus", it can see my username and password :( How can i hide username and password. thanx. (1 Reply)
Discussion started by: temhem
1 Replies

6. UNIX for Dummies Questions & Answers

Shell program with username and password

Hi I am new to unix and I am trying to figure out how to write a shell script with a login name and password. I want to do something along the lines of if both are correct it echoes "you are logged in" and if the password is wrong it echoes "wrong password" and same with the login name. I've tried... (7 Replies)
Discussion started by: thedemonhunter
7 Replies

7. UNIX for Dummies Questions & Answers

FTP Download username and password

I am trying to download from ftp server (rsync and postfix). But every time I connect to the ftp server, it prompts for USER and PASS but I don't know which username and and password to use. And I am using command based UNIX OS. (2 Replies)
Discussion started by: kumarrana
2 Replies

8. Solaris

I want to hard code username and password for an FTP connection

Hi all i want to do FTP via running a shell script and i want to hard code username and password for that particular server.. by writing it in a file can u help me in this regard.. Thank u Naree (2 Replies)
Discussion started by: naree
2 Replies

9. Shell Programming and Scripting

username password in script

Can we write a script to telnet to a unix server from unix with the username and password hardcoded in the script?? something like ssh a@b -p password ??? (5 Replies)
Discussion started by: roshanjain2
5 Replies

10. UNIX for Advanced & Expert Users

setting username and password for ftp

hi, i have set up an FTP server in one of our systems. could some one tell me the procedure to set up the username and password for it to enable other users to access the server. thanks (1 Reply)
Discussion started by: div
1 Replies
Login or Register to Ask a Question