SFTP: FTP to secure sites
If you can only use
ssh to connect to a remote
site, chances are it won't support regular FTP transactions either, probably due
to higher security. Mac OS X also includes a version of
ftp that is
compatible with the standard SSH server programs and works identically to
regular FTP. Just type
sftp at the command line. Here's an
$ cd downloads $ sftp email@example.com Connecting to intuitive.com... The authenticity of host 'intuitive.com (18.104.22.168)' can't be established. RSA key fingerprint is d0:db:8a:cb:74:c8:37:e4:9e:71:fc:7a:eb:d6:40:81. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'intuitive.com,22.214.171.124' (RSA) to the list of known hosts. firstname.lastname@example.org's password: sftp> cd mybin sftp> dir -l drwxr-xr-x 0 24810 100 1024 Jun 26 20:18 . drwxr-xr-x 0 24810 100 1536 Sep 16 18:59 .. -rw-r--r-- 0 24810 100 140 Jan 17 2003 .library.account. info -rwxr-xr-x 0 24810 100 3312 Jan 27 2003 addvirtual ... -rw-r--r-- 0 24810 100 406 Jan 24 2003 trimmailbox.sh -rwxr-xr-x 0 24810 100 1841 Jan 24 2003 unpacker -rwxr-xr-x 0 24810 100 946 Jan 22 2003 webspell sftp> get webspell webspell 100% 946 4.7KB/s 00:00 sftp> quit $ ls -l webspell -rwxr-xr-x 1 taylor taylor 946 25 Sep 11:28 webspell
FTP with a web browser
If you need a file from a remote site, and
you don't need all the control that you get with the
you can use a web browser to download files using anonymous FTP. To do that,
make a URL (location) with this syntax:
For instance, ftp://somecorp.za/pub/reports/2001.pdf specifies the file 2001.pdf from the directory /pub/reports on the host somecorp.za. In most cases, you can also start with just the first part of the URL—such as ftp://somecorp.za—and browse your way through the FTP directory tree to find what you want. If your web browser doesn't prompt you to save a file, use its Save menu command.
NOTE: If you are using the Safari browser, it will open ftp: directories by mounting them in the Finder.
An even faster way to download a file is with the
curl (copy from URL) command. For example, to save a copy of the
report in the current directory, simply enter:
$ curl -O ftp://somecorp.za/pub/reports/2001.pdf
curl will display the file
in the Terminal window. If you want to read a text file from an Internet server,
you can combine
$ curl ftp://ftp.oreilly.com/pub/README.ftp | less
You can also use
curl with web pages, but this will bring the
page up in HTML source view:
$ curl http://www.oreilly.com | less
Other FTP solutions
One of the pleasures of working with Unix within the Mac OS X environment is that there are a wealth of great Aqua applications. In the world of FTP-based file transfer, the choices are all uniformly excellent, starting with Fetch, NetFinder, Transmit, FTPeel, rbrowser, and Anarchie, and encompassing many other possibilities. Either open the Apple menu and select "Get Mac OS X Software . . . ", or try VersionTracker (see http://www.versiontracker.com/), Mac OS X Apps (see http://www.macosxapps.com/), MacUpdate (see http://macupdate.com/), or the shareware archive site Download.com (see http://www.download.com/).
Easy Shortcuts with Connect to Server
The Terminal application has a
very helpful feature that can make connecting to remote systems via
breeze, once it's set up. Connect To Server is available off the File menu and
is shown in Figure
To add a service, click on the + icon on the left side of the window. More commonly, you'll add servers, which you can do by clicking on the + icon on the right side of the window. It produces a window that asks for the hostname or host IP address, which is easily entered, as shown in Figure 8-5.
Once added in one area, the new server is available for all services, so to
connect to Apple's anonymous FTP archive site, choose
ftp, then the
new server name, and then enter
ftp into the User box, as
shown in Figure
Finally, the connection to Apple's server is a breeze: specify the server, specify the user, and click on Connect. The results are shown in Figure 8-7.
You can practice your
ftp skills by connecting to the public FTP
archive ftp.apple.com. Log in as ftp with your email address
as the password, then look around. Try downloading a research paper or document.
If you have an account on a remote system, try using
scp to copy files back and forth.
ssh, you can run an agent program, such as
ssh-agent, that asks for your passphrase once, then handles authentication every time you run
 Quotes tell the local shell not to interpret special characters, such as wildcards, in the filename. The wildcards are passed, unquoted, to the remote shell, which interprets them there.
Dave Taylor is a popular writer, teacher and speaker of business and technology issues. The founder of The Internet Mall and iTrack.com, he's been involved with UNIX and the Internet since 1980. He's also been a Mac fan since the year it was released.
Brian Jepson is an O'Reilly editor, programmer, and co-author of Mac OS X Panther for Unix Geeks and Learning Unix for Mac OS X Panther. He's also a volunteer system administrator and all-around geek for AS220, a non-profit arts center in Providence, Rhode Island. AS220 gives Rhode Island artists uncensored and unjuried forums for their work. These forums include galleries, performance space, and publications. Brian sees to it that technology, especially free software, supports that mission. You can follow Brian's blog here.
Return to Mac DevCenter
- Trackback from http://www.disobey.com/dnn/2004/04/index.shtml#001594
Blink, Blink, Sniff, Sniff
2004-04-09 07:34:53 [View]
ssh does not handle the resource fork
2004-04-02 18:34:25 avi [View]
ssh does not handle the resource fork
2004-04-02 18:37:00 avi [View]
2004-03-31 11:58:21 csoto [View]
2004-03-29 22:50:28 agjest [View]
2004-03-29 13:48:21 epistemos [View]
SCP paths and spaces
2004-03-29 16:52:26 alantech [View]
Accessing Your Mac Remotely
2004-03-29 07:44:04 [View]
2004-03-29 07:43:05 kms007 [View]
routers? How to access?
2004-03-29 07:48:24 Brian Jepson | [View]
routers? How to access?
2004-03-29 07:59:49 kms007 [View]
Unix on Panther: Accessing the Internet
2004-03-26 19:04:04 [View]