Working with SFTP

K

K Viltersten

As i noticed, there's no built-in facility
for working with SFTP in DotNet. So, i'd
like to learn how to build that up. When i
went googling for knowledge, i only get a
ton of hits on tutorials for specific,
already existing packages.

The problem is that i'd like to learn how
set up such a communication myself. Any
pointers? (Please note that googling for
"c# sftp ssh tutorial" won't give you much
joy, sadly...)
 
M

Michael B. Trausch

As i noticed, there's no built-in facility
for working with SFTP in DotNet. So, i'd
like to learn how to build that up. When i
went googling for knowledge, i only get a
ton of hits on tutorials for specific,
already existing packages.

The problem is that i'd like to learn how
set up such a communication myself. Any
pointers? (Please note that googling for
"c# sftp ssh tutorial" won't give you much
joy, sadly...)

First result for "C# SSH library":

http://www.codeproject.com/KB/IP/sharpssh.aspx

HTH,
Mike

--
My sigfile ran away and is on hiatus.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREDAAYFAkj4KYwACgkQ0kE/IBnFmjCF7gCghuPfLmBjJe7GOPJmiQyvejCV
gYcAn2RmXMNOtKfkIC7x43OBG4pCIiVa
=IY6X
-----END PGP SIGNATURE-----
 
K

K Viltersten

First result for "C# SSH library":

Hmm... I'l try that right away, of course,
and, while being thankful for the help, i
can't stop wondering why you omitted "SFTP"
in your search. Is "SSH" and "SFTP"
equivalent terms?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
"Michael B. Trausch" <[email protected]> skrev i meddelandet
news:20081017015836.3e26bd46@zest...
 
M

Marc Gravell

Is "SSH" and "SFTP" equivalent terms?

Related, certainly: SFTP is FTP over SSH; FTPS is FTP over SSL.

Marc
 
M

Michael B. Trausch

Hmm... I'l try that right away, of course,
and, while being thankful for the help, i
can't stop wondering why you omitted "SFTP"
in your search. Is "SSH" and "SFTP"
equivalent terms?

SSH is a transport mechanism, which can do secure remote shells (a
replacement for telnet/rsh, and probably the most popular application of
the SSH protocol), and it has two more-or-less "subprotocols," SCP
(replaces rcp) and SFTP (replaces FTP and is designed for more
human-based interaction). SSH can also tunnel arbitrary information
between machines for anything that isn't inherently secure by way of
SSL or some other form of encryption mechanism.

SCP is more tightly tethered to SSH, while SFTP can be used over other
secure protocols. See the Wikipedia articles covering the topics for
an overview:

http://en.wikipedia.org/wiki/Secure_Shell
http://en.wikipedia.org/wiki/SSH_file_transfer_protocol
http://en.wikipedia.org/wiki/Secure_copy

On UNIX systems, the commands for SSH, SCP and SFTP are all in the same
package (assuming that the system uses OpenSSH). For example, on
Ubuntu:

Friday, 2008-Oct-17 at 02:32:46 - mbt@zest - Linux v2.6.27
Ubuntu Intrepid:[0-21/6080-0]:~> dpkg -S $(which ssh scp sftp)
openssh-client: /usr/bin/ssh
openssh-client: /usr/bin/scp
openssh-client: /usr/bin/sftp

HTH,
MIke

--
My sigfile ran away and is on hiatus.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREDAAYFAkj4MeMACgkQ0kE/IBnFmjAFiACfQ0L4NSHPc5pbpRC89u8hzREX
lw0AnAo66a1a41enYHuVbQR1J83a7Cm+
=Zzz+
-----END PGP SIGNATURE-----
 
K

K Viltersten

First result for "C# SSH library":
SSH is a transport mechanism, which can do secure
remote shells (a replacement for telnet/rsh, and
probably the most popular application of the SSH
protocol), and it has two more-or-less
"subprotocols," SCP (replaces rcp) and SFTP
(replaces FTP and is designed for more human-based
interaction). SSH can also tunnel arbitrary
information between machines for anything that
isn't inherently secure by way of SSL or some
other form of encryption mechanism.
SCP is more tightly tethered to SSH, while SFTP can
be used over other secure protocols. See the
Wikipedia articles covering the topics for an
overview:
http://en.wikipedia.org/wiki/Secure_Shell
http://en.wikipedia.org/wiki/SSH_file_transfer_protocol
http://en.wikipedia.org/wiki/Secure_copy

Thanks. I'll need to keep looking though. The
example you've found is only a wrapper for an
already existing JSSH-library, while i'm aiming
at getting it done myself.

Nevertheless, thanks a lot.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
"Michael B. Trausch" <[email protected]> skrev i meddelandet
news:20081017023411.5355d77d@zest...
 
M

Michael J. Ryan

Hmm... I'l try that right away, of course,
and, while being thankful for the help, i
can't stop wondering why you omitted "SFTP"
in your search. Is "SSH" and "SFTP"
equivalent terms?

SFTP is FTP over SSH...
FTPS is FTP + SSL...

--
Michael J. Ryan - tracker1(at)theroughnecks(dot)net - www.theroughnecks.net
icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)

.... Immortality lies not in the things you leave behind, but in the people
your life has touched.
 
M

Michael B. Trausch

Thanks. I'll need to keep looking though. The
example you've found is only a wrapper for an
already existing JSSH-library, while i'm aiming
at getting it done myself.

Nevertheless, thanks a lot.

Uhm.

Did you not look at the source code?

It's a *port* of an SSH library from Java to C#. It isn't a wrapper.
From the site:
After experimenting with an open source Java SSH library called JSch
I decided to try and port it to C# just for the sake of exercise. The
result is the attached sharpSsh library and this article which
explains how to use it.

An updated version of the SharpSSH library is available on the author's
Web site, as well:

http://www.tamirgal.com/home/dev.aspx?Item=sharpSsh

It's a bit tied to Windows at the moment, since it uses P/Invoke on at
least kernel32.dll, so it could use some work to be cross-platform, but
other than that, the whole thing is written in C#.

--- Mike

--
My sigfile ran away and is on hiatus.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREDAAYFAkj4xt0ACgkQ0kE/IBnFmjCIHgCfca/R2KvMcZuNxfQrhl1hFEWO
93gAn2xDFS0lfQ/iBvcHCeGesg0WTOHK
=g8rz
-----END PGP SIGNATURE-----
 
J

javaftpclient

As i noticed, there's no built-in facility
for working withSFTPin DotNet. So, i'd
like to learn how to build that up. When i
went googling for knowledge, i only get a
ton of hits on tutorials for specific,
already existing packages.

As others have said SFTP is a subsystem of SSH. You establish an SSH
connection, and SFTP consists of a series
of messages encapsulated within SSH messages.

It is a pretty major effort actually implementing it yourself.

It sounds like you may not be interested in commercial packages, but
just in case ... take a look at edtFTPnet/PRO

http://www.enterprisedt.com/products/edtftpnetpro/overview.html

It supports both SFTP and FTPS - you can easily swap between the two
protocols.

regards

Bruce Blackshaw
 
K

K Viltersten

Thanks. I'll need to keep looking though. The
Uhm.
Did you not look at the source code?
It's a *port* of an SSH library from Java to C#.

Of course i looked at the code. Perhaps i was too
hasty in my judgement but what i understood was
that it was merely a wrapper for the Java
version. Maybe i should check that out again...
It isn't a wrapper. From the site:
"After experimenting with an open source Java
SSH library called JSch I decided to try and
port it to C# just for the sake of exercise. The
result is the attached sharpSsh library and this
article which explains how to use it."

An updated version of the SharpSSH library is
available on the author's Web site, as well:
http://www.tamirgal.com/home/dev.aspx?Item=sharpSsh

All right. I guess i got scared and/or confused.
I'll look into that again. Thanks.

By the way, what's up with your mail client? It
seems that all the answers come as attachments,
instead of plainly seeable text. Perhaps it's MY
mail client that sucks...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top