1820886 Members
3695 Online
109628 Solutions
New Discussion юеВ

Mget with SFTP 5.50

 
SOLVED
Go to solution
Aneesh Mohan
Honored Contributor

Mget with SFTP 5.50

Hi all,

I need an urgent help.

mget command with sftp (HP Secure Shell 5.50) is not working.

errore :- Invalid command.

Can I know is there any way I can have command alias in sftp .

Something like alias mget="get -r".


Aneesh
12 REPLIES 12
Bill Hassell
Honored Contributor

Re: Mget with SFTP 5.50

You are confusing sftp with ftp. sftp is not ftp with encryption, it is a file transfer protocol built on top of ssh. Here are some details:

http://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol

The only commands that work can be found by typing ? after you establish an sftp connection. mget (and mput) do not exist. For multi-file transfers, it is much, much easier to use scp than to use sftp. scp supports multiple directories and recursion down through subdirectories.

If you are using a PC, WinSCP is very easy to use and has the ability to restart from a disconnect and continue where it left off.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: Mget with SFTP 5.50

Shalom

sftp is a different client than ftp.

There is no mget function.

You need to send or get files with the correct file name.

You can use wildcards with scp however. both scp and sftp are part of openssh, which is called secure shell by HP

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven Schweda
Honored Contributor

Re: Mget with SFTP 5.50

> mget command with sftp (HP Secure Shell
> 5.50) is not working.
>
> errore :- Invalid command.

As usual, showing an actual command with its
actual error message can be more helpful than
vague descriptions and interpretations.
(That includes "ssh -V".)

> Something like alias mget="get -r".

It might help if you explained exactly what
you'd like to do, rather than how you'd like
to do it.


> There is no mget function.

Note that some SFTP client programs do offer
"mget" and "mput" commands, but the benefit
may be pretty small:

sftp> help mget
mget [ ... ]
Synonymous to get.
sftp> help mput
mput [ ... ]
Synonymous to put.
Aneesh Mohan
Honored Contributor

Re: Mget with SFTP 5.50

Hi all,

I am sorry for the late response.

The problem I am facing is many of our application scripts using SFTP (includes mget command) are failing after upgrade of HP Secure Shell 5.50 from HP Secure Shell 5.30 .Those scripts were working with HP Secure Shell 5.30 before.

As per my investigation , I came to know that the scripts are failing with invalid command at mget command.

I am wondering mget command was available with HP Secure Shell 5.30 and not in HP Secure Shell 5.50.


Thanks and Regards,
Aneesh
Steven Schweda
Honored Contributor

Re: Mget with SFTP 5.50

> [...] scripts using SFTP (includes mget
> command) are failing [...]

With the older Secure Shell version, did
"mget" do anything different from "get"? I
know nothing, but if "mget" always was only
an alias for "get", then they might have
removed it, figuring that no one would care.
And, if that is the case, then changing a
script to use "get" could be pretty easy.

> I am wondering [...]

man sftp
Aneesh Mohan
Honored Contributor

Re: Mget with SFTP 5.50

The problem is there are many scripts more than 700 scripts using by different application teams , I am not sure how many of them are with mget.

If there is any way of making alias to mget=get -r , then this can be solved easily.

For time being I have rolled back SSH version to 5.30 .

Aneesh
Steven Schweda
Honored Contributor

Re: Mget with SFTP 5.50

> [...] I am not sure how many of them are
> with mget. [...]

man grep

Then:

man sed

> If there is any way [...]

I didn't see one. But if you had to add that
to every script, then couldn't you change
"mget" to something else about as easily?

Or did you expect sftp to look at your shell
aliases?
Bill Hassell
Honored Contributor

Re: Mget with SFTP 5.50

sftp has a history of difficulties, especially mput/mget as well as get -r. According to release notes, mput/mget have been removed in version 5.50. This is a good thing because they were not reliable. A Google search show a number of hits on various platforms with hangs:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=428082
"The old mget/mput commands never worked properly and have been removed..."

http://en.wikipedia.org/wiki/OpenSSH
"scp, a replacement for rcp, and sftp, a replacement for ftp to copy files between computers"

So, the 700 scripts that currently use sftp are at risk of having problems and should all be recoded to use scp. sftp, like ftp, is very cumbersome to code while scp is a 1-liner. If your sftp code uses additional commands like chown and chgrp, these can be implemented with ssh.

Or you could replace sftp with a script that accepts sftp commands and translates them into scp and ssh commands.


Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: Mget with SFTP 5.50

> Or you could replace sftp with a script
> that accepts sftp commands and translates
> them into scp and ssh commands.

Or into different sftp commands.


I'd probably edit the scripts.
Aneesh Mohan
Honored Contributor

Re: Mget with SFTP 5.50

Hi Bill,

>>According to release notes, mput/mget have been removed in version 5.50.

I couldn`t find the above information from HP Secure Shell 5.50 release note.

Kindly could you please provide me the reference.

Hi Steven,

Thanks for your info,I know how to use grep and sed for this if I have all the scripts location.

Unfortunately ,we don`t have a centralize SFTP scripts (location) documentation from all our application team.I can know only if there is any failure reported.If there is no way to make mget command avilable with SSH 5.50 , then I will call a meeting & collect SFTP scripts information from all our team and update "mget" with "get -r" .




Aneesh
Bill Hassell
Honored Contributor
Solution

Re: Mget with SFTP 5.50

>>According to release notes, mput/mget have been removed in version 5.50.

> I couldn`t find the above information from HP Secure Shell 5.50 release note.

HP simply repackages the open source code. The reference I gave above is from a Debian document. It really doesn't matter that it is not documented -- it doesn't work. When you run sftp interactively, you can type the help or ? command and the server will provide a list of available commands. mget/mput are gone. Whether get -r works will have to be determined empirically since the HP docs are also silent on get -r. But as I found in searching various comments about mget/mput for openSSh, the code is not very reliable. I don't think I would ask all your programmers to make the change until get -r has been thoroughly tested.

I was able to find these references to mget/mput at the OpenSSh site: www.openssh.org

http://marc.info/?l=openssh-unix-dev&w=2&r=1&s=mget&q=b

It is interesting that there is no documentation for mget as a client command, hp.com or opensss.org. In looking through the HP docs for Secure Shell, there is no reference to mget/mput (back to 5.10):

5.30
http://docs.hp.com/en/5992-5185/index.html

5.20
http://docs.hp.com/en/T1471-90037/index.html

5.10
http://docs.hp.com/en/T1471-90036/T1471-90036.pdf


Bill Hassell, sysadmin
Aneesh Mohan
Honored Contributor

Re: Mget with SFTP 5.50


Thanks Bill.

So HP Secure Shell 5.50 release note is an incomplete document , It is really a pain that we cannot trust a document from HP.


Regards,
Aneesh