Secure FTP transfers
Getting images, files and folders onto and off a Slice can cause difficulties with concerns about security.
This article takes a look at SFTP - part of the SSH package - as a way of securely transferring files to your Slice.
Installation
SFTP (SSH File Transfer Protocol) is part of the SSH package.
In other words, there is nothing to install as it is ready to use.
Configuration
There is also nothing to configure.
Once you have setup your user(s) and configured SSH for your needs, SFTP uses the same usernames and ports.
Please see the Slice setup articles for more details of the initial Slice configuration - Ubuntu Hardy - Slice setup #1
Security
As mentioned, SFTP uses the SSH protocol to connect to your Slice.
As such, the connection and all data is encrypted to prevent any eavesdropping of passwords or sensitive data.
SFTP Client
We can start by looking at an SFTP client.
The 'client' is a programme on your local workstation. I won't go into listing all the available SFTP clients but suffice to say that the vast majority of modern FTP clients also support SFTP (keep in mind SFTP does not use the 'typical' FTP protocols and so some older FTP clients may not support SFTP).
You can search for SFTP clients for Windows, OS X, Linux or other Operating Systems.
Due to the vast array of clients available I can't go into how to use each one (they should have plenty of documentation with the software).
However, the preferences/options panel will allow you to enter the SFTP details.
Take a look at this example:

If you have followed the setup articles (see the link above) you will notice the details are the same as those we used to setup SSH.
We have the Slice IP, the user named 'demo', we are using port 30000 (the same port we set in the sshd_config file).
The protocol has been specified as SFTP - this particular client has several options available.
Lastly, you should be able to set the path for the UI. In this case, I want to open the client in my home partition.
Once I have submitted the information, I am connected to the Slice:

Note: In this case I have accessed the Slice at the root folder level. As such, you can browse the folders as shown above.
Most clients will allow you to 'double click' on a file and edit it in a local browser.
Permissions
Which brings us nicely to permissions.
Do remember that you are using the same details as the SSH user - as such they won't be able to automatically edit files owned by root.
All that would happen is a nice 'permission denied' error if you tried to open or save any changes to a root owned file.
So what to do about the permissions?
Well, to be honest, there isn't a lot you can do about it. The permissions are there for a good reason and are an integral part of Linux and how it is designed.
Neither do I recommend logging in as root - part of the initial SSH setup entailed disabling root logins.
However, beyond the initial Slice setup, there should be little reason to mess around with files owned by root and any changes in configurations would be done from the command line using the 'sudo' command.
The main reason for using SFTP clients is to ease the transfer of files - most of which will be to your public_html folder which you will have permission to write.
Summary
Secure FTP connections are very easy when using SFTP - it is already installed as part of SSH and all you need is a client that supports the SFTP protocol.
Transferring files and folders to your home directory has never been easier or more secure.
PickledOnion


Article Comments:
Brian Pence commented Wed May 28 15:45:20 UTC 2008 ago:
Try AbsoluteTelnet. It's a great SSH client and I just add SFTP in the latest version. It has a nice GUI interface. Check my sig for the location.
Brian Pence Celestial Software http://www.celestialsoftware.net AbsoluteTelnet (for telnet and ssh)
nek4life commented Thu May 29 00:33:51 UTC 2008 ago:
How would one go about setting sftp up for up for more than one user account? Say I have multiple users for multiple domains and I want to lock them in their websites directory.
Van Glass commented Thu May 29 21:00:07 UTC 2008 ago:
For a free no-install, platform independent FTP/S, SFTP client you might want to look at AnyClient
loudestnoise commented Thu Jun 05 18:22:01 UTC 2008 ago:
@nek4life You would need to create a new user and the way I have it set up, I put the public web root of each user's domain they need access to inside their user account, which then allows you to to effectively lock them to their domain as they don't have permissions to write to anything outside of their user account since they are not a sudoer unless you make them one.
Mike Fernandez commented Fri Jun 27 06:04:16 UTC 2008 ago:
I am just wondering "Permission denied" always pops out my SFTP client, Transmit. Can you help me? Anyone? Thanks!
Mike Fernandez commented Fri Jun 27 06:11:47 UTC 2008 ago:
Sorry guys, my bad. My SFTP now works. I used the wrong user that's why. Thanks!