Login or Register to Ask a Question and Join Our Community

[Solved] auto sftp

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] auto sftp
# 1  
Old 11-07-2011
[Solved] auto sftp

i was able to script:

ftp -n hosname << DONE
user username pwd

can i do same as sftp ? i tried, but it keeps asking for pwd. when i typed pwd, and it worked fine.

Last edited by jim mcnamara; 11-07-2011 at 03:56 PM.. Reason: please do not use funny fonts, do use code tags
# 2  
Old 11-07-2011
First you need to setup ssh password less authentication
Here you you are the script
sftp -oBatchMode=no -b - user@host << !
cd dir
put yourfilelog

# 3  
Old 11-07-2011
That is called a here document.

That will work with sftp ONLY if you set up ssh keys, otherwise you always get asked for the password. Keys == Not hard to do at all.

Complete step by step example:

ssh-keygen: password-less SSH login
# 4  
Old 11-09-2011
Jim, thank you much. worked perfectly.

---------- Post updated 11-09-11 at 06:58 AM ---------- Previous update was 11-08-11 at 11:50 AM ----------

i tried to use mput or mget with sftp, but not working. how can i get multiple files such as mget/mput *, mget/mput test.*, mget/mput test*
# 5  
Old 11-09-2011
sftp regular get and put can handle multiple files.
# 6  
Old 11-09-2011
And is "bin" an option?
# 7  
Old 11-09-2011
i tried get log.1 log.2 log.3, and it only get log.1

sftp> bin
Invalid command.
sftp> as
Invalid command.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Howto auto boot SPARC | How to auto supply "start /SYS" and "start /SP/console" commands

When I power ON my T4-1, I got a prompt -> where I have to start /SYS and start /SP/console. How can I auto supply these two commands ? (3 Replies)
Discussion started by: z_haseeb
3 Replies

2. Shell Programming and Scripting

[Solved] Need to auto increment

Hello, this is a VI question more than anything... I'm using: SunOS 5.10 Generic_150400-04 sun4v sparc SUNW,T5240 I'm trying to find a problematic line(s) in a script. The only solution I can think of is to tag each repetative line, and increment it. This is an oracle insert script. ... (14 Replies)
Discussion started by: graphi
14 Replies

3. UNIX for Dummies Questions & Answers

[Solved] ls -l in CentOS 6.4 after upload using sftp

Hi everyone, Something rather interesting just happened to me. I uploaded a file to a server through sftp. I closed the connection and then logged on to the server via ssh. So far so good. When I typed ls -l in the remote server to retrieve a directory listing, the file that was previously... (2 Replies)
Discussion started by: gacanepa
2 Replies

4. Shell Programming and Scripting

[Solved] Do not want to print sftp commands in log

Hi, While running my ksh file, I require the logs to be written to another file. For this I use the below code: write_log() { echo `date +"%d %h, %Y %H:%M:%S"` " : " $* >> ${LOG_FILE} } But inside my ksh file, am connecting to sftp server and executing some commands. So while i see... (8 Replies)
Discussion started by: confused_info
8 Replies

5. Shell Programming and Scripting

[Solved] SFTP problem

Hi, I'm new to sh scripting and have the following problem. I have a script to sftp that is now working with ssh key. But i need to change this, i wan't to sftp with a password. I have the following script, tried a lot to make a variabel for the password. But i can't make it work ... (2 Replies)
Discussion started by: kvhindex
2 Replies

6. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: kingr008
1 Replies

7. Shell Programming and Scripting

[Solved] SFTP error - Couldn't close file: Failure

I am trying to send a file from my 9000 box to a vendor using sftp and I am getting this error: Couldn't close file: Failure Here are the results of my automated script: Connected to yyy.com. sftp> pwd Remote working directory: / sftp> cd xxxxx/yyyyy_TEST/TEST sftp> put FILE FILETEST... (1 Reply)
Discussion started by: nickg
1 Replies

8. Shell Programming and Scripting

sftp auto login

Hi, I looked into lot of posts on this question but i could not figure out the solution. we are using the following ftp shell program to send the file to target server. #!/usr/bin/ksh ftp -n -i<<EOF 2>&1 open <target server ip> user <username> <pwd> lcd /sc/doc/prd/FCSTP put file1.txt... (3 Replies)
Discussion started by: srrao.ch
3 Replies

9. Solaris

Auto login with SFTP

Hi All, How do you get around SFTP not having the 'cat' command to set up scripts to run cron jobs for passwords? I am use to the FTP allowing that, but we are converting to SFTP and need to be able to still run the same scripts in off hrs. Is there a way to still cat the password at the prompt... (14 Replies)
Discussion started by: wsiefkas
14 Replies
Login or Register to Ask a Question

Featured Tech Videos