Sftp cmd


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers Sftp cmd
# 1  
Old 09-25-2013
Network Sftp cmd

What is the cmd line to connect sftp, specifing the port number and the shh key file.

When I use the below cmd format, it gives the msg :node name or service name not known, but I know the connection works, because the automated sftp script works fine and I can log into the remote server

sftp -o port=??? IdentityFile=/your/private/key user@sftpserver
# 2  
Old 09-25-2013
Use the -o option a second time
Code:
sftp -o Port=xxxx -o IdentityFile=/your/private/key user@sftpserver

# 3  
Old 09-25-2013
using the -o option twice works, what is the use of using the -o twice.

Also thx for the solution.
# 4  
Old 09-25-2013
The -o option is used to pass one option to the sftp-command. You need two of them, so you need two -o.

You also could put the options in your ~/.ssh/config file, so you don't have to pass them on the command line:
Code:
Host sftpserver
    Port xxxx
    IdentityFile /your/private/key

---------- Post updated at 16:31 ---------- Previous update was at 16:26 ----------

You even can add the username
Code:
Host sftpserver
    Port xxxx
    IdentityFile /your/private/key
    User user

then all you need on the commandline is
Code:
sftp sftpserver

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with cmd while using ps

Hi i am new to shell scripting and any help is really appreciated. my requirement is in, ps -e -o pid,uname,cmd how can i split and take only the cmd part from it. I tried awk but the issue is when the cmd is returning a lengthy command which itself has some spaces it is truncating the... (7 Replies)
Discussion started by: Jojo90
7 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

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 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. Shell Programming and Scripting

Unix cmd prompt how to get old cmd run?

Hi, I am using SunOS I want to serch my previous command from unix prompt (like on AIX we can search by ESC -k) how to get in SunOs urgent help require. (10 Replies)
Discussion started by: RahulJoshi
10 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. UNIX for Dummies Questions & Answers

mv cmd

Hi All, How can I move only files to another destination using mv cmd in hp-ux. (2 Replies)
Discussion started by: mhbd
2 Replies

9. Programming

open cmd

if((LogFile=open(TempStr,O_CREAT|O_WRONLY|O_APPEND,0666))==-1) return(1); could someone explain me what the open() does here (2 Replies)
Discussion started by: bankpro
2 Replies

10. UNIX for Dummies Questions & Answers

man <cmd> >> cmd.txt

I've noticed most of my postings here are because of syntax errors. So I want to begin compiling a large txt file that contains all the "man <cmd>" of the commands I most have problems with. I ran a "man nawk >> nawk.txt" but it included a header/footer on each "page". Anyone know how I'd be... (6 Replies)
Discussion started by: yongho
6 Replies
Login or Register to Ask a Question