SFTP automation with password/passphrase


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users SFTP automation with password/passphrase
# 1  
Old 06-04-2009
SFTP automation with password/passphrase

Hi All,
We have a special requirement from our client, we need to automate one of the sftp job with password authentication. I know sftp can be automated with Key authentication, but this is not what I am looking for.

Can some body help me, a method like .netrc in FTP automation or like sftp user/password@server method.

Thanks
Shihab
# 2  
Old 06-04-2009
This can be done with either batch mode, or with external language, such as TCL/Expect. Please use our search function, and I'm sure you will find your option, personally I have posted at least 5 times sample Expect code for SFTP automation.
In both cases the password will be placed in a plain format, so this has security risk.
# 3  
Old 06-05-2009
Thanks Sysgate for your reply..
Unfortunately we cannot use expect or any other external language. Is there any way to do it via batch mode ?
# 4  
Old 06-09-2009
No, there is no standard way to do it via batch mode. However you can set up scp to do what you want via batch mode.
# 5  
Old 07-15-2009
Question SFTP or SCP with password authentication.

Hi, I have exactly the same situation as mentioned by Shihab above. I can not use ssh/public/private keys. I can not use expect. Is there a way for this ? What do I need to setup SCP with to be able to do this?
Basically I want to trf a file frm server 1 to server 2. I cant use ftp. I have to use sftp or scp. I cant use expect/other tools. I cant use ssh/public/private keys setup.
Pl suggest a solution.
# 6  
Old 07-17-2009
No, there is no solution to use sftp with password in a batch mode by simple shell.

You have to resort to expect/perl/java...
# 7  
Old 07-22-2009
I forgot to mention in my previous post that you could also use lftp to automate a password prompt sftp session. lftp is standard on a lot of GNU/Linux distributions and is available for HP-UX, Solaris etc.

Here is a short script to retrieve a file called tmpfile from /tmp on a server using lftp in sftp mode
Code:
#!/bin/sh

HOST=yourservername
USER=yourusername
PASS=yourpassword

echo "sftping file ..."

lftp -u ${USER},${PASS} sftp://${HOST} <<EOF
cd /tmp
get tmpfile
bye
EOF

echo "done"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sftp automation script not working

Hi all , can any one tell me how to code SFTP automation script ? I searched lots of forums but i didn't get any useful information:( I don't want auto Login script > like if u run the script it should automatically login into specific account and etc.. Just i want the following things... (4 Replies)
Discussion started by: sravan008
4 Replies

2. Shell Programming and Scripting

Yet another sftp automation question

Hello, I've read quite a few of the sftp questions and answers on the forum but I believe my situation is slightly different. I need to automate an sftp transfer to a host that requires not only a ssh publickey, but also a password. When I try using sftp in batch mode, supplying a "user... (4 Replies)
Discussion started by: n3llyb0y
4 Replies

3. UNIX for Dummies Questions & Answers

password automation

i am doing automation of report in unix. i am copying files from different server using scp command.. if i use scp its asking for password for copying files..is there any way to automate this password issue.. can anyone help me out??? tahnks in advance, Arun Manas (4 Replies)
Discussion started by: arunmanas
4 Replies

4. Shell Programming and Scripting

sftp Connection from Unix to Windows 2003 server using Passphrase

Hi All, I am trying to connect from Unix machine to Windows 2003 server using passphrase method. It is connecting to the server and the connection is immediately closing. Below is the stack trace. Can anyone let me know what wrong with it? cwadmin@iut1wps1:/home/cwadmin> ssh username@targetip... (1 Reply)
Discussion started by: vijayin
1 Replies

5. Shell Programming and Scripting

Need help with user password automation

Hello, I need some assistance in trying to figure out the best way to automate user account password resets. The environment is a mix of 2000 HP-ux, aix, linux, and sunos boxes. The security specs are to reset pw's every 90 days. Most boxes are only accessible from within a current ssh... (2 Replies)
Discussion started by: deviousdoses
2 Replies

6. Cybersecurity

Password Automation pros/cons

folks, I have a security related question, to all you. Please share your comments with me. I have a situation where i was asked to automate the password in my application, which expires every 6 months. In this case i need to generate a random password and set the password on some... (2 Replies)
Discussion started by: sudharma
2 Replies

7. Shell Programming and Scripting

SFTP password automation

I am working on a script to automate and SFTP that I am currently doing to a company that does not allow for a .ssh profile to be created. I have search and read about the -b option and am wondering if i can get some more information about it. I tried to right a file containing the password... (3 Replies)
Discussion started by: jaycheetwood
3 Replies

8. Shell Programming and Scripting

SFTP - non-interactive - using passphrase

Hi, I have written a script that does SFTP successfully without using the password (Thanks to this site :b: ) and it works fine. The thing is - this script uses the public and private key generation with a "null" passphrase. But I now need to write a script that does SFTP non-interactively... (1 Reply)
Discussion started by: sandy0077
1 Replies

9. Shell Programming and Scripting

SFTP & Passphrase('s)

Hi all, I generally use the something along the lines of the following when I need to perform SFTP's ... sftp -v -o IdentityFile=${IdentityFile} \ -b ${SFTP_BATCH_FILE} \ ${USRID}@${IP_OR_DNS}:${REMOTE_DIR} 2>&1 | tee -a ${SFTPLOG}Now currently we are not using any passphrase... (4 Replies)
Discussion started by: Cameron
4 Replies

10. Solaris

SSH passphrase and Password

Hello all, Today we run ssh with keys on all our Solaris systems. But I wounder: Is it possible to add another authentication too. Like the os/system regular password so the users first need to enter the ssh phasssphrase and after that they need to enter the os/system password. I need like... (3 Replies)
Discussion started by: jOOc
3 Replies
Login or Register to Ask a Question