PDA

View Full Version : [ubuntu] SFTP using Open SSH


East82
August 13th, 2009, 02:44 PM
Looking to transfer files securely via SFTP w/SSH on Ubuntu Server. My FTP client is Filezilla on Ubuntu Desktop.

I want to the server to reject any connection that is not secure ...in other words reject any FTP request and only accept SFTP. Any help is appreciated.

doas777
August 13th, 2009, 02:46 PM
just install ssh. you don;'t have to install ftp itself. ssh won't allow a non-encrypted connection, so you should be fine by default. you may wanna use winscp for your client on windows though. never tried a traditional ftp client with scp.

dollarmenunaire
August 13th, 2009, 02:52 PM
I suppose could use an SSH tunnel to tunnel the FTP traffic to where ever it is you are going, however there is a secure transfer method that uses SSH called scp on linux.

From which direction are you transferring files from, are you going to the Ubuntu machine, or from the Ubuntu to machine to say a Windows box?

East82
August 13th, 2009, 02:58 PM
I suppose could use an SSH tunnel to tunnel the FTP traffic to where ever it is you are going, however there is a secure transfer method that uses SSH called scp on linux.

From which direction are you transferring files from, are you going to the Ubuntu machine, or from the Ubuntu to machine to say a Windows box?

Thanks. I will check into SCP ...new to me. I also have LAMP installed. Does Apache have FTP and, if so, how would I disable?

My environment is strictly Ubuntu. Would like to put and get files on the server.

dollarmenunaire
August 13th, 2009, 03:18 PM
Apache will not come with an FTP server/client like for instance IIS does with FTPD if I remember correctly.
If you do not need the FTP server running then either remove it through dpkg or prevent it from starting up though the init script.

dpkg --list

Find the name of the FTP server you have and:
dpkg --remove [ftpserver-name]

Using the purge option will remove the config files also.

To learn more about scp, man scp in a terminal. Its really simple.

XCan
August 13th, 2009, 06:09 PM
Looking to transfer files securely via SFTP w/SSH on Ubuntu Server. My FTP client is Filezilla on Ubuntu Desktop.

I want to the server to reject any connection that is not secure ...in other words reject any FTP request and only accept SFTP. Any help is appreciated.

just install ssh. you don;'t have to install ftp itself. ssh won't allow a non-encrypted connection, so you should be fine by default. you may wanna use winscp for your client on windows though. never tried a traditional ftp client with scp.

You can use Filezilla fine. As mentioned above, if you don't install an FTP server you won't be able to connect through the FTP protocol anyway. You could try it out with Filezilla, unless you select the correct protocol (may be called SSH/SSH2/SFTP) your connection won't be accepted. Personally, I use gFTP to connect to my machines through sftp.

scorp123
August 14th, 2009, 07:53 AM
...in other words reject any FTP request That's easy. Don't install any FTP server. Voila, done.

and only accept SFTP. You only installed OpenSSH server, right? OK then. That's it already. Case solved.

SFTP (a sub-protocol of SSH) and FTP (unsafe!) have nothing to do with each other except that both can transfer files and they share three letters "F", "T" and "P". That's what seems to confuse you? :)

Dr Small
August 14th, 2009, 09:51 AM
That's easy. Don't install any FTP server. Voila, done.

You only installed OpenSSH server, right? OK then. That's it already. Case solved.

SFTP (a sub-protocol of SSH) and FTP (unsafe!) have nothing to do with each other except that both can transfer files and they share three letters "F", "T" and "P". That's what seems to confuse you? :)
One stands for Secure File Transfer Protocol, whereas the other one only stands for File Transfer Protocol. They both transfer files, only FTP transfers the login credentials along with all the data in plain text across the network(s), whereas SFTP has an encrypted tunnel through which everything travels.

Personally, when I'm on the commandline, I tend to use scp more than I ever do sftp. But, if I'm on an Ubuntu system with Gnome, I just use SFTP and connect to the remote host.

Dr Small

Rob_H
August 14th, 2009, 10:59 AM
That's easy. Don't install any FTP server. Voila, done.

You only installed OpenSSH server, right? OK then. That's it already. Case solved.

SFTP (a sub-protocol of SSH) and FTP (unsafe!) have nothing to do with each other except that both can transfer files and they share three letters "F", "T" and "P". That's what seems to confuse you? :)

Right. The SFTP acronym is unfortunate because it's easily confused with traditional FTP, but they are very different. To make matters worse, FTPS is related to FTP. Confused yet? ;-) In short:

SFTP = SSH file transfers
FTPS = FTP over SSL

scorp123
August 14th, 2009, 04:41 PM
One stands for Secure File Transfer Protocol, whereas the other one only stands for File Transfer Protocol. And this contradicts my posting how???

They both transfer files Yes, and that's about it. They are totally different internally and have not much else in common except their intended functionality (transferring files) and three letters in their abbreviations. As I said above.

scorp123
August 14th, 2009, 04:48 PM
To make matters worse, FTPS is related to FTP. Yes, that' true. Unfortunately. But I seriously would not recommend anyone to use this. Good ol' FTP (please note the sarcasm right here ...) as it was, was already bad enough and already had its fair share of troubles. Anyone who ever had the pleasure of being firewall administrator in a professional environment can tell you volumes about it. Configuring the firewalls so each and everyone's stupid FTP client would get through and not terminate any transfers prematurely was close to "black magic". But FTPS makes matters worse by introducing this SSL-layer on top in a very "hackish" way ... It's a pain.

So for anyone who wants to configure secure file transfers: Do yourself a favour and stick to SSH (easy to setup and yet totally secure!) and its sub-protocols SCP and SFTP. Avoid FTP (too unsafe!) and FTPS (= classic FTP with SSL on top ... too hackish, too much of a pain to get working).

XCan
August 14th, 2009, 07:10 PM
Yes, that' true. Unfortunately. But I seriously would not recommend anyone to use this. Good ol' FTP (please note the sarcasm right here ...) as it was, was already bad enough and already had its fair share of troubles. Anyone who ever had the pleasure of being firewall administrator in a professional environment can tell you volumes about it. Configuring the firewalls so each and everyone's stupid FTP client would get through and not terminate any transfers prematurely was close to "black magic". But FTPS makes matters worse by introducing this SSL-layer on top in a very "hackish" way ... It's a pain.

So for anyone who wants to configure secure file transfers: Do yourself a favour and stick to SSH (easy to setup and yet totally secure!) and its sub-protocols SCP and SFTP. Avoid FTP (too unsafe!) and FTPS (= classic FTP with SSL on top ... too hackish, too much of a pain to get working).

There are a couple of daemons that run FTPS out-of-the box or almost-out-of-the-box. drftpd, glftpd, proftpd comes to mind. Actually that got me interested. In Windows I've been using ultrafxp and filezilla and they've been working flawlessly, with tons more commercial alternatives. What alternatives (graphical) are there in Ubuntu? I've found out that filezilla's been ported to linux, but haven't tried it yet. It seems like ftps is more about using a client that supports it rather than the ftpd itself.

lensman3
August 14th, 2009, 08:35 PM
They only problem I have found using sftp is that with the Filezilla program, I can go up a directory and see all the users who are under /home. This isn't OK when you want secrecy and to keep users from snooping.

There is a chroot sftp server that keeps the users "locked up", but the directory structure is not the default.

Hope this might help.

Dr Small
August 14th, 2009, 09:23 PM
And this contradicts my posting how???

Yes, and that's about it. They are totally different internally and have not much else in common except their intended functionality (transferring files) and three letters in their abbreviations. As I said above.
Lol, I never intended to contradict your post, just elaberate. :)

East82
August 15th, 2009, 01:01 AM
Scorp,
Thanks for clearing that up!

scorp123
August 15th, 2009, 05:21 PM
Lol, I never intended to contradict your post, just elaberate. :) My apologies. Not enough coffee .... :lolflag:

Dr Small
August 16th, 2009, 09:47 AM
My apologies. Not enough coffee .... :lolflag:
No problem, mac. I know how it is :D

kevdog
August 16th, 2009, 04:41 PM
Hmm, seems like the utility of this thread has waned. I wish linux had a good gui app like winscp or something to do sftp

XCan
August 16th, 2009, 05:23 PM
There are quite a few FTP apps supporting it and providing enough usability, and I find that they are in no way inferior to winscp.

kevdog
August 16th, 2009, 06:39 PM
There are quite a few FTP apps supporting it and providing enough usability, and I find that they are in no way inferior to winscp.

References?

scorp123
August 16th, 2009, 07:18 PM
I wish linux had a good gui app like winscp or something to do sftp Nice joke. :lolflag:

But seriously, maybe nobody has told you: But pretty much any filemanager here on Linux "speaks" SSH/SFTP.

If you have GNOME:

Open your filemanager (which is called "Nautilus" here). You usually find it under Places > Home Folder

Now hit the "Location Button" so it toggles from "button view" into "text field view" so you can type addresses into the text field. (It's the button that looks like a pencil writing on a sheet of paper directly below the "File" menu but above the left "Places" pane ....)

And now simply type a remote SFTP location into that field:
sftp://remote-username@ssh-server.your-domain.net

Voila, working with SFTP is as simple as using your normal file manager.


If you have KDE:

Same principle, except here they call it "fish://" (short for "SSH file share" or something like that?). So you'd type this into the KDE file manager:
fish://remote-username@ssh-server

Voila. It just works.

And it's definitely better than WinSCP or FileZilla on Windows.

Other SCP/SFTP GUI programs that work:

gftp
filezilla


You will find those in the repositories (e.g. via the "Synaptic" package manager).

One really nice text-mode tool is "yafc" ... You could give that one a try too. It's useful on servers that don't run a GUI. Or if "Norton Commander" is more your thing you'll love "mc". It can handle SCP/SFTP too and it pretty much feels like "good old" Norton Commander on ancient MS-DOS.

Enough SFTP GUI tools for ya?

Quod erat demonstrandum. :D

XCan
August 17th, 2009, 10:06 AM
References?

?

http://gftp.seul.org/screenshots.html Select SSH2 as protocol instead of FTP. I'm sorry, I didn't write an article on it. But filezilla and ultrafxp on Windows have worked great for sftp, and so has gftp on Ubuntu.

Bottom line is that winscp isn't any kind of black magic. The underlying parts are easy enough to implement in an FTP app.

Rob_H
August 17th, 2009, 02:24 PM
Hmm, seems like the utility of this thread has waned. I wish linux had a good gui app like winscp or something to do sftp

Nautilus and Dolphin (the GNOME and KDE file managers) handle this right out of the box.

EDIT: Oops, sorry, I somehow missed the subsequent replies that said the same thing. One clarification, though: You don't need to use "fish:" in KDE. It supports "sftp:" directly now.

scorp123
August 17th, 2009, 04:43 PM
You don't need to use "fish:" in KDE. It supports "sftp:" directly now. Thanks for adding that. I haven't really seen or used KDE since I left the world of SUSE (as it was called back then) back in 2004 ...

Rootong
August 18th, 2009, 12:32 PM
It sounds like FTP+TLS what you want to implement. SFTP is the sub-protocol of SSH. You can try TLS first. It's good enough.

scorp123
August 18th, 2009, 04:18 PM
It sounds like FTP+TLS what you want to implement. NO! How did you come to that conclusion??

Haven't you read the previous posts? FTP+anything is seriously broken and a pain in the bowels. Why in the world would anyone do that when SFTP simply works out of the box with far less troubles??

bear24rw
August 18th, 2009, 04:25 PM
NO! How did you come to that conclusion??

Haven't you read the previous posts? FTP+anything is seriously broken and a pain in the bowels. Why in the world would anyone do that when SFTP simply works out of the box with far less troubles??

I agree openssh-server and filezilla are all your need, forget FTP