![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Complete Idiot's Guide to Linux
Controlling AccessAnother skill that youll need when publishing Web pages is to protect materials from general users, unless they are able to provide an acceptable login and password. This is very simple to do, and it requires that you do a couple of things. To protect a number of documents, create a directory. You can call it anything you want. Inside this directory, create a file called .htaccess (note that the name of the file begins with a period [.]). Inside this file, put the following text: AuthUserFile /home/yourusername/.htpasswd AuthName Albertos Secured Area AuthType Basic require valid-user AuthUserFile specifies the location for a password file that will be used to validate users. Note that this file lives outside the public_html directory or the DocumentRoot tree. Replace yourusername with your login name. AuthName is a name that identifies this set of documents. Its typically displayed by the browser on the password request dialog. AuthType defines the type of authentication used. Well use Basic. Require specifies that the only authenticated users should be let in (valid-user option). After you put this file in the secured directory, all files and directories under this are protected. Creating an htpassword File Web server passwords are managed by a tool called htpasswd. This tool exists in /home/httpd/bin/htpasswd. The arguments are simple: htpasswd [-c] filename username The c option creates the password file using the filename specified (in my case, I defined mine in /home/yourusername/.htpasswd), followed by the name of the user to add to the file: [alberto@digital stuff]$ /home/httpd/bin/htpasswd -c /home/alberto/.htpasswd alberto Adding password for alberto. New password:********** Re-type new password: ********** Thats all. Anyone trying to access the directory will be asked to authenticate. If the authentication succeeds, they have access to the page(s). SMB: Sharing Disks and Printers to PCsIf your computer is on a heterogeneous network, more than likely there are Windows-based PCs sharing the network with you. Linux, again, can provide file sharing to other OSs, such as those running Windows. Windows PCs see the file shares as another PC sharing a network drive. As a client, Linux can connect to a Windows PC, allowing you to transfer files to your Linux box. SAMBA is the common name for the service that allows you to do this. SAMBA is an acronym for the SMB protocol (Server Message Block), which allows Windows-based PC access to disks and printers from Linux and from Linux to Windows-based PC printers and disks. This service is complex and well-developed; however, it has many gotchasespecially if you are trying to connect to Windows NT 4.0 SP3 or Windows 98 computers. To use SAMBA, you first need to download the latest version from http://samba.gorski.net/samba/samba.html. The versions shipped by most manufacturers are out of date. There are RPM packages you can install available right at the site. Accessing a PC Network Drive from Linux: smbclientYou use smbclient to access a PC network drive. The command has many options, and some systemssuch as Windows NT and Windows 95are picky about wanting to talk with Linux. For this reason I will refer you to the SAMBA documentation in the /usr/doc/samba-1.9.18p8-Caldera.1 directory for more information on installation and configuration. Listing Services To see a list of the services provided by a PC host, provide the L option to the smbclient command. By default, Linux will attach your UNIX login name. If your login is different on the PC, specify it with the U option, like this: smbclient L smbhostname U pcloginname It is possible that some hosts will give you grief if you supply a login name that is not in all caps. Heres a transcript of such a session with an NT4.0 Workstation. Note that the NT host required me to provide a password: [alberto@digital alberto]$ smbclient -L pri -U ARICART Added interface ip=192.168.0.2 bcast=192.168.0.255 nmask=255.255.255.0 Got a positive name query response from 192.168.0.1 ( 192.168.0.1 ) Server time is Sat Sep 26 18:39:17 1998 Timezone is UTC-5.0 Password: ******** Domain=[WORKGROUP] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0] security=user Server=[PRI] User=[] Workgroup=[WORKGROUP] Domain=[] Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share CD Disk HD Disk HPLaserJ Printer HP LaserJet 4/4M Plus PS 600 IPC$ IPC Remote IPC print$ Disk Printer Drivers shared Disk This machine has a browse list: Server Comment --------- ------- DIGITAL Samba 1.9.18p8 PRI This machine has a workgroup list: Workgroup Master --------- ------- WORKGROUP PRI From the listing, I know that this machine has several resources I can use, including a printer and access to a disk.
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |