PDA

View Full Version : FTP via SSH


reefland
Thu 8th Jan '04, 3:16am
This probably isn't the right forum but...

I am going to be moving my site to a new server in the next coming days. I have SSH access on both and was wondering if I could use the steps in the movingservers.html instructions to move all my files to the new server. Obviouslt following these intructions you can do it 1 file at a time but can you move a directory in the same manner?

Scott Z.

Raz Meister
Thu 8th Jan '04, 7:52am
Use sftp (secure ftp) or an FTP client that support sftp.

Erwin
Thu 8th Jan '04, 8:10am
To be honest, you shouldn't use normal ftp, since your username and password are passed in normal text. sftp keeps your username and password encrypted since it uses ssh (ideally ssh2).

Marc Smith
Thu 8th Jan '04, 9:04am
This probably isn't the right forum but...

I am going to be moving my site to a new server in the next coming days. I have SSH access on both and was wondering if I could use the steps in the movingservers.html instructions to move all my files to the new server. Obviouslt following these intructions you can do it 1 file at a time but can you move a directory in the same manner?

Scott Z. I haven't read movingservers.html - where ever that is. I've heard all the paranoia about using standard ftp. I've used it for years and have it turned on on my servers. When I move files server-to-server I can do it in 1/10 the time and can only do it via normal ftp. Maybe someone can tell me how to do a server-to-server transfer using sftp, but i haven't succeeded.

The arguement against 'standard' ftp is that someone many be 'listening' to your stream and see you unencrypted login and password. I'm not IBM or a big company so I'm not worried about someone listening to my stream. It would be a stroke of luck - I don't ftp things that often, the part of the stream is up front so they would have to be listening at that specific second or two when login occurrs.

I'm not the brightest guy around but I put my first site on the internet in January 1996 and I've never had a problem.

For every day stuff I use sftp. It's easy and it's my laptop to the server. But if I have to move a lot of data - as in moving a site from one server to another - I tarball the appropriate directories and do a server-to-server transfer. One the other end I un-tar the directory, change file ownership - group as necessary (use -R and all the files in the directory will be changed with the one command) and that's it. I tar the htdocs (user_html or however the server is set up) and cgi-bin directories.

Raz Meister
Thu 8th Jan '04, 11:06am
Maybe someone can tell me how to do a server-to-server transfer using sftp, but i haven't succeeded.done it many times.

log in via normal ssh on the target server. from the prompt launch sftp to login to the source computer.

personally i use scp to copy files about instead of sftp.

Steve Machol
Thu 8th Jan '04, 11:11am
personally i use scp to copy files about instead of sftp.I use scp too. And if your server has ssh, it's likely to have scp too.

reefland
Thu 8th Jan '04, 3:08pm
Thanks guys, I'll give sftp and scp a try.

Regards,
Scott Z.

splooge
Fri 9th Jan '04, 2:19am
Basically it's pretty simple to use.

To copy a file locally to a remote host:
scp filename.ext username@yourhost.com:~

To copy a file from a remote host:
scp username@yourhost.com:~/filename.ext .

Raz Meister
Fri 9th Jan '04, 10:07am
If you're on Windows, you could use the scp that comes with cygwin or PuTTY

reefland
Fri 9th Jan '04, 6:06pm
Well I tried both sftp and scp and they both work on a single file but not an entire directory. What I was trying to do was take an entire folder and move it and all of it's contents via SSH instead of downloading via FTP from the old machine and then uploading to the new machine.

Thanks,
Scott Z.

Steve Machol
Fri 9th Jan '04, 6:19pm
Actually scp does support directories. From the man page:

-r Recursively copy entire directories.

reefland
Fri 9th Jan '04, 6:24pm
Ok, I apologize for being so green but could you give me line by line examples of moving a directory from one machine to another using scp?

I guess it would be something like this:
sftp MACHINE2
scp -r directoryname

?

Thanks,
Scott Z.

reefland
Fri 9th Jan '04, 6:51pm
Ahh, I got it!

For anyone who may need to know the same info:
scp -r directoryname newmachineip:placeinsidethisdirectory

:D
Scott Z.