I would be happy, if someone help me on this that I have only SFTP ID and Password to transfer some log files from webserver boxes to SFTP server
Anyone help me that how to pass the password parameter throough the shell scripts, since i don't have ssh login access on the SFTP Server.. only option to pass the password through my script.
Could you generate a key pair with ssh-keygen, retrieve the .ssh/authorized keys from the target server, add your public key to the file and then put that back to the server? That might give you a password-less sign on, but of course, it depends if the server locks your account to a directory from which you cannot get to the .ssh directory. The directory might not exist, so you could probably create it, but you will need to make sure the permissions are rwx --- ---
If you already have a key pair generated, consider connecting as normal with SFTP and:-
Of course, this assumes that the remote server put it's authentication files in ~/.ssh and that you can get to it, but it might be worth a try.
Look in ~/.ssh to see if you already have key generated, but to generate a key-pair / pair of certificates, just run ssh-keygen and follow the prompts.
I hope that this helps. It is not tested and perhaps it's just the hacker in me with a twisted mind, but this might get you going and ease the SFTP to becoming:-
... where sftp.cmds is a plain file containing the cd, get, put or whatever commands to execute when connected.
Robin
Liverpool/Blackburn
UK
Last edited by rbatte1; 05-28-2013 at 06:38 AM..
Reason: Re-phrased a bit
Dear All,
I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Hi,
Can anyone tell me how to pass password in a shell script for sftp so that i can run it in background without user entering the password?
I used a expect script but it timesout after some time and the process remains incomplete at the end.
Can anyone suggest any other idea?
Will the... (3 Replies)
Hi All,
I am trying to transfer a file from one server to a remote server using SFTP. Client is not ready for key setup.
I am working on Solaris 10.
Here is the code.
#!/bin/ksh
# sample automatic Sftp script to dump a file
USER="user1"
PASSWORD="pass1"
HOST="host1"
sftp $USER@$HOST... (6 Replies)
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)
I am working on a sftp batch script on a Solaris machine and I need to connect using password. This is not an issue when i do it manually but when I want to make this into a script, i find there are no options for password.
Can anyone suggest how I can do it with password? I know using keys is... (3 Replies)
Hi,
I have script which does the sftp function. In the script in one place it able to read the password from file and other place files with below error.
warning: has much more security than supplying the password in the clear
warning: on the command line.
Failed to get password: File... (0 Replies)
I am trying to SFTP to a couple sites. One has an RSA-KEY that was sent to me. Currently I am running that manually using WinSCP. I would like to set it up as a CRON process on our Linux host (Sun).
Can I use the rsa-key they sent me in any directory or does it need to be placed in a specific... (2 Replies)
I want to write an sftp script, but I can't put ssh keys on my destination. Is it possible to pass sftp a password inside a script? I know that the -b option makes sftp use a file for params. Can the password go in such a file? How can I do this? Thanks in advance (3 Replies)
Hi,
I'm writing a script which actually sftp's(gets!! i'm using mget) files from a windows box to unix server. (i've gone thru forum and got pretty good answers, Thx for that).
but the windows box to which i'm ftp'g prompts for a password change every 30 days. so please suggest me how to do... (3 Replies)