SFTP and SCP

23 09 2008

So after uploading the majority of what I wanted to the server, I decided it was time to close the ftp port. I read a lot of stuff about it being the most vulnerable point, and one of the first ports hackers try. So I read up on SFTP or Secure FTP, and SCP and decided to learn how to use that. Since I had already installed SSH on the server, SFTP and SCP were ready to be used. So I closed the ftp port and have been using these ever since.

SFTP is alright for downloading single files and the way I use it, you can upload music folders pretty easily, since the filenames in a music folder should end in the same extension i.e .mp3. SCP is for downloading directories recursively, so you don’t have to download each individual file, although I suppose you can use SFTP to download like I use it to upload. Since I haven’t found something that allows me to recursively upload with either of these (SCP doesn’t support the put command), I have to improvise a little. Anyway, you can use this source to learn SFTP commands, although if you already know unix, the commands are basically the same. This site on the other hand, explains how to use SCP.

Right now, when I wanna upload a directory with music and it’s structured:

Artist

—-|_    Album

————–|_   Song1.mp3

—————— Song2.mp3

—————— Song3.mp3

I do the following. First I create the Artist and Album folders on the remote server. Then I run the following after connecting via SFTP.

sftp> put *.mp3

The * is a wildcard, which basically says you don’t care about any characters before that, and then the .mp3 would be what I assume (or know) all the songs in that folder end in. This has proven to work well so far, I still don’t have a solution for directories with various types of files. I’m open to some suggestions.

Advertisements

Actions

Information

3 responses

23 09 2008
Bob

Are you doing this from a Windows computer using PuTTY, or from another Linux/Ubuntu desktop computer?

If you are doing it from an Ubuntu/Debian/whatever Linux desktop computer just select Places –> Connect to Server and choose SSH as Service Type.

This will get you a nice Nautilus window connection to your server where you can simply copy and paste or drag and drop.

23 09 2008
Bob

Oh wait, I read your post again and think I see what you’re getting at. You wish to use SCP to transfer an entire directory full of various files, correct?

If so, you just need to use the -r ‘recursive’ option. So to send something from your desktop computer to your server:

me@desktopcomputer:~$ scp -r somedirectory me@myserver:

This will copy the entire ‘somedirectory’ directory and all of its contents from your desktop computer to /home/me/somedirectory on your server computer.

23 09 2008
baudday

Those are both cool. I was searching all over and couldn’t find out how to upload with scp, so I figured you couldn’t without a special extension. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: