noninteractive SFTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting noninteractive SFTP
# 1  
Old 08-17-2010
noninteractive SFTP

Hi All,

need help.

i am doing one SFTP and now need to automate that.
how can i achive it with non interactive mode?

SFTP user@172.*.*.*

then it is asking for password.
after providing that its getting connected.

can you please help me so that i can give the password at a go and it does not ask for password again?

thanks

NIL
# 2  
Old 08-17-2010
You need passwordless SSH login. You need to generate a public key using the ssh-keygen utility for your machine you use to do remote login and upload the key to the remote machine.
# 3  
Old 08-17-2010
I think one is to use a public key authentication. This will provide password-less authentication as long as you client's public key is made the authorized on the server.

However I am not sure if you have control over the SFTP server.

Another option is to use "expect" script.

-Raja
# 4  
Old 08-17-2010
hello raja,

the SFTP server is under control..

even i can do SFTP but giving the password when it prompts.
i need to bypass that prompt.

---------- Post updated at 01:02 PM ---------- Previous update was at 12:49 PM ----------

hello kevin,

i have issued ssh-keygen

Generating public/private rsa key pair.
Please be patient.... Key generation may take a few minutes
Enter file in which to save the key (/portal_home/pin/.ssh/id_rsa): nil
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in nil.
Your public key has been saved in nil.pub.
The key fingerprint is:
e0:ca:42:60:2a:09:52:f7:3


now can you please help me how to upload the key on remote machine?
# 5  
Old 08-17-2010
I hope you didnt enter a passphrase while generating the public key. Else it will prompt for a passphrase instead of password.

Copy the contents of nil.pub to ~/.ssh/authorized_keys file in the destination system (sftp server). Please note that the key is one single line and ensure this while copying.


You can test it by ssh to the server and it should get you in without the password.

-Raja
# 6  
Old 08-17-2010
hello Raja,

i didnt enter anything in passphrase.
~/.ssh/ in this location i can see a file known_host.
authorized_keys is not there.. should i create it and then paste?

Niladri
# 7  
Old 08-17-2010
Yes. Please create a file authorized_keys and copy the public key.

On the safer side, make a copy of this file as authorized_keys2 on the same directory.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

3. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

4. Shell Programming and Scripting

sftp

Hi, Can you please tell me what the below command does cat <<EOF1 > $tmp1 binary lcd $targetDir cd ${remoteDir} ls quit EOF1 cat $tmp1 set -x sftp6 -P 2246 -B $tmp1 --password=file://<ctl>/.gspass | tee outputfile Actually my requirement is if the sftp succeed, then only it... (3 Replies)
Discussion started by: help_scr_seeker
3 Replies

5. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

6. Ubuntu

I want to upload file on remote machine in noninteractive mode through SFTP

Hi All, I want to upload file through SFTP in non interactive mode on remote server. please tell me what will have to do in oreder to do SFTP . (1 Reply)
Discussion started by: kulbhushan
1 Replies

7. AIX

SFTP Failed---Request for subsystem 'sftp' failed on channel 0

Hi, While I am trying SFTP my machine to another unix machine , it was working fine till 10 min back. But now i am getting the below error "Request for subsystem 'sftp' failed on channel 0" Could you please someone help me to solve or analyise the root cause... Cheers:b:, Mahiban (0 Replies)
Discussion started by: mahiban
0 Replies

8. OS X (Apple)

sftp

can anyone suggest somewhere i might learn how to set up sftp and ssh on os x tiger? I dont find any literature on it other then suggestions of thirdparty programs to do this for you.:confused: (3 Replies)
Discussion started by: RahJiggah
3 Replies

9. UNIX for Dummies Questions & Answers

sftp

Hi, I am trying to setup a sftp connection to the local host for testing purposes. The machine is on a extranet behind a firewall which makes it difficult to test to other machines on the network as I do not manage to Firewall. I am just testing the concept for now to determine what needs to be... (2 Replies)
Discussion started by: hugow
2 Replies

10. Post Here to Contact Site Administrators and Moderators

Sftp

Hi All, Greetings! when a script file is passed to the SFTP command at the unix prompt, Is it possible to supress the keyboard input for user authentication. If yes, please let me know the way to do it. Thanks for any/all help at the earliest. Regards, Dheeraj. (1 Reply)
Discussion started by: dheeruchakri
1 Replies
Login or Register to Ask a Question