1. Trang chủ
  2. » Công Nghệ Thông Tin

22.2. FTP

3 179 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 3
Dung lượng 38,87 KB

Nội dung

22.2. FTP FTP sites (file transfer protocol) store pieces of software that can be accessed from the Internet. If you've heard of FTP at all, it was probably under one of two circumstances— either you've downloaded software from an Internet FTP site, or you've created and maintained your own Web site. POWER USERS' CLINIC CGI Scripts A CGI script (Common Gateway Interface) is a program— written in a language like Perl, AppleScript, or Python—that runs right on your Web page. You've seen these on many a Web page: Web-visitor counters, interactive polls, shopping forms, and so on. Apple even includes a few of them with Mac OS X; they're in your System Library Perl [version number] CGI Scripts folder, for example. If you've got a CGI script of your own that you'd like to incorporate into your Web page, copy it into your Library WebServer CGI folder. (This means you, administrators.) The script's Web address becomes http://111.222.3.44/cgi-bin/scriptname. (Substitute your actual public IP address and the real name of the script file, of course.) Unfortunately, you won't get far testing out your CGI script, because it comes with its "execute" permissions turned off. To turn them on again, you need to use the chmod (change mode) command. You can use a permission-changing shareware program like SuperGetInfo, available from the "Missing CD" page of www.missingmanuals.com, or you can do the job in Terminal, as described on Section 16.7. (In this case, you'd type sudo chmod 755 test-cgi.) The chmod command is a quick way to change access privileges—including Execute permission, which isn't available in the File Get Info window. The 755 business is a long story, which you can read at any Terminal prompt by typing man chmod and hitting Enter. In short, however, this code is shorthand for "Change the permissions so that everyone else can read and execute (but not make changes to) this file"—just what you want for a CGI script. After hitting Enter, you're ready to proceed. Now sudo asks for your administrator's password. Once you've entered it, press Enter; the deed is done. You can test your script either on the same Mac (http://localhost/cgi-bin/test- cgi) or on another one across the network or across the Internet (http://111.222.3.44/cgi-bin/test-cgi). 22.2.1. Uploading and Downloading from FTP Sites Hooking into an FTP site generally requires an FTP client program that runs on the kind of computer you use (Mac, Windows, or whatever). On Mac OS X, popular FTP client programs include the shareware programs Transmit, Fetch, Interarchy, and Captain FTP, and the free RBrowser (which is available from the "MissingCD" page at www.missingmanuals.com . Using these programs, Web designers, for example, can view a list of all the text and graphics documents, sitting there on an Internet-connected computer somewhere, that make up their Web pages. The effect is shown in Figure 22-3 . When they want to update one of those pages, they add it to this list; to delete a Web page, they remove it from this list. Figure 22-3. Top: To access your Mac OS X machine from across the Internet, fire up a program like RBrowser and use the address ftp://111.222.33.4 (or whatever your public IP address is). Be sure the first pop-up menu says FTP, not Public FTP—otherwise, you won't be offered the chance to type in your account name and password. Bottom: Once you're looking at an FTP server's contents, you can drag files from your desktop into the list. Copy them to your Mac by dragging them out of the list onto your desktop, or open them by double-clicking. 22.2.2. Just Downloading from FTP Sites If you're just going to look at and download files (but not upload or delete any), you don't even need a special FTP program. You can get to the files much more directly using one of these two methods: • Any old Web browser will work. Open Safari, for example, and type ftp://ftp.apple. com (or whatever the address is) into the address bar. A dialog box asks for an account name and password, if they're required. Once you're in, you switch to the Finder and see the contents of the FTP site as a window full of standard file icons. (In other browsers, you see the list of the FTP site right in the browser window.) • Using the Finder's Go Connect to Server command, you can mount read-only FTP volumes right on your desktop, much like a public iDisk. In the Connect to Server dialog box, just enter the address of the FTP server you would like to mount—ftp://ftp.apple.com , for example. You'll soon see the ftp.apple.com icon appear on your desktop, looking just like your other disks. Open it up and drag out whatever you want to download. 22.2.3. Becoming an FTP Server Thanks to Mac OS X and its Wonder Unix, you can also turn your own Mac into an FTP site. Once again, the key is the Sharing pane of System Preferences; this time, turn on the File Sharing checkbox, click Options, and click "Share files and folders using FTP." Click OK. Once again, the key to your own Mac is its public IP address (see the box on Section 22.1). At this point, you, or other people you trust, can connect to your FTP server by running an FTP program like RBrowser (see Figure 22-3 ) or just typing ftp://111.222.33.4 (or whatever your public IP address is) into their Web browsers.   . Internet (http://111 .22 2 .3.44/cgi-bin/test-cgi). 22 . 2. 1. Uploading and Downloading from FTP Sites Hooking into an FTP site generally requires an FTP client program. trust, can connect to your FTP server by running an FTP program like RBrowser (see Figure 22 - 3 ) or just typing ftp: //111 .22 2 .33.4 (or whatever your public

Ngày đăng: 07/11/2013, 09:15

Xem thêm

w