Complete Idiot's Guide to Linux:Sharing Files over the Network
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="../../../../../www.itknowledge.com/PSUser/EWBookMarks.html@url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Controlling Access
Another 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 PCs
If 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: smbclient
You 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.
Previous
Table of Contents
Next
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.
Wyszukiwarka
Podobne podstrony:
272 275272 275272?1105 operator koparko ladowarkiBrother Fax 255, 275, 355, 375, 515, 525 Parts ManualSHSpec 272 6306C11 Engram Chain Running272 273demo cgi 2723500classic RM 272 RM 273 schematics v1 0272 273274 275275 Prawo pocztowewięcej podobnych podstron