Auto Script to Access external Server via SFTP using Password and Key


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Auto Script to Access external Server via SFTP using Password and Key
# 1  
Old 10-22-2012
Computer Auto Script to Access external Server via SFTP using Password and Key

Hello All,

I am stuck!

I have access to an external server via SFTP. In order to access the external server I was given a specific port, password, and a ppk.

I would to create a script on my server end that can I can setup as a corn job, that will connect to the external server and download what ever is in the folder.

Thus far I was able to have a bash script that will automate the log-in process but not include the download of the files.

Any help you can provide would be nice. If you can provide an example script or reference links.

Thanks a lot in Advance.
# 2  
Old 10-22-2012
You can create a control file to connect and run the SFTP commands.

Something like below:-

Code:
cat > sftp_control.cntrl
cd <destination path>
get <file name>

Then run it by passing it to SFTP:-

Code:
sftp -b sftp_control.cntrl user@host

You can use your script to create the commands in the control file.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

2. HP-UX

Connect to remote server using sftp with password define within command/script

I am trying to connect to remote server in hp-ux, using sftp command (using sftp username@ip and password ) able to connect to remote server but, in this case sftp prompt for password and user need to manually enter it. I want sftp can read a password define in script or from file, so it can... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Script to log in SFTP server [with username, password]

Hi, everyone, I am trying to write a script to login automatically using username and password to an sftp server (the key authentication has been disabled so I cannot use that method). I tried to search online for a solution and found a way using "expect" but my boss does not want me to use... (4 Replies)
Discussion started by: warmboy610
4 Replies

4. Shell Programming and Scripting

Password in sftp NOT with key

I've been trying to get out of this, but my manager wont budge. He wants to sftp files from a server while passing the password in the script. I have said we need to use keys...he said no. I asked if we had expect capability...no. He said "use -b batch file command" I have checked every... (1 Reply)
Discussion started by: MJCreations
1 Replies

5. UNIX for Dummies Questions & Answers

SFTP syntax without specifying private key location (no password)

Hi all, I need to connect using SFTP from Red Hat to Windows. Connection between servers work when I specify location of my private key in the script. However, I want to use syntax without private key location specified. I know this should work, as I found it in older scripts. Scripts were... (0 Replies)
Discussion started by: yavvie
0 Replies

6. Cybersecurity

Web Server Allows Password Auto-Completion

Hi, After running 'nessus' tool to find the Vulnerability in server OS - RHEL 5 we got " Web Server Allows Password Auto-Completion (PCI-DSS variant)" link for description provided by tools - report Nessus Plugins | Tenable Network Security I have checked - Their is only... (1 Reply)
Discussion started by: saurabh84g
1 Replies

7. AIX

SFTP from one server to another with password

All, Is there a possibility to sftp a file from one AIX server to another AIX server with password? I do not want to use public or private key option as we would have required privileges for creating the keys. So Please provide the needful with a sample script. Thanks in Advance, Vijayakumar S... (2 Replies)
Discussion started by: kuppu.uncle
2 Replies

8. Shell Programming and Scripting

SFTP in Shell Script with RSA-KEY or password.

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)
Discussion started by: alemat
2 Replies

9. UNIX for Dummies Questions & Answers

How to add SFTP KEY to UAT SERVER?

Hi All, I have some SFTP Key. I would like to know how do I add them to UAT Server? Please help. Thanks (0 Replies)
Discussion started by: jingi1234
0 Replies
Login or Register to Ask a Question