Unix on Panther: Accessing the Internet
Pages: 1, 2, 3
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
example:
$ cd downloads
$ sftp taylor@intuitive.com
Connecting to intuitive.com...
The authenticity of host 'intuitive.com (128.121.96.234)' 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,128.121.96.234' (RSA) to the list
of known hosts.
taylor@intuitive.com'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 ftp program,
you can use a web browser to download files using anonymous FTP. To do that,
make a URL (location) with this syntax:
ftp://hostname/pathname
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
Without the -O option, 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 and less:
$ 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
telnet, ssh, ftp, or sftp a
breeze, once it's set up. Connect To Server is available off the File menu and
is shown in Figure
8-4.

Figure 8-4. Connect to Server offers simple shortcuts
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.

Figure 8-5. Adding a New Server to Connect to Server
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
8-6.

Figure 8-6. Specifying user ftp on ftp connections to
ftp.apple.com
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.

Figure 8-7. Instant connection to Apple's ftp server
Practice
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 rcp and
scp to copy files back and forth.
Footnotes
[1] In
ssh, you can run an agent program, such asssh-agent, that asks for your passphrase once, then handles authentication every time you runsshorscpafterward.[2] 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]
-
OpenSSH is a godsend
2004-03-31 11:58:21 csoto [View]
-
Fugu
2004-03-29 22:50:28 agjest [View]
-
SCP paths and spaces
2004-03-29 13:48:21 epistemos [View]
-
SCP paths and spaces
2004-03-29 16:52:26 alantech [View]
- Trackback from http://www.mennoboy.com/chris/macblog/archives/000737.html
Accessing Your Mac Remotely
2004-03-29 07:44:04 [View]
-
routers? How to access?
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]
-
routers? How to access?
2004-03-29 08:02:38 Brian Jepson |
[View]
-
routers? How to access?
2004-03-29 08:22:26 kms007 [View]
-
routers? How to access?
2004-03-29 09:17:12 Brian Jepson |
[View]
-
routers? How to access?
2004-03-30 04:36:57 kms007 [View]
- Trackback from http://blog.samdevore.com/2004/03/26.html#a2144
Unix on Panther: Accessing the Internet
2004-03-26 19:04:04 [View]

