old-www/LDP/LG/issue19/micro.html

160 lines
5.8 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Using SAMBA to Mount Windows Issue 19</title>
</HEAD>
<BODY BGCOLOR="#EEE1CC" TEXT="#000000" LINK="#0000FF" VLINK="#0020F0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
&quot;Linux Gazette...<I>making Linux just a little more fun!</I>&quot;
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H2>Using SAMBA to Mount Windows 95</H2>
<H4>By Jonathon Stroud,
<a href="mailto:jgstroud@eos.ncsu.edu">jgstroud@eos.ncsu.edu</a></H4>
</center>
<P><HR>
<p>Many major universities are now offering network connections to
students in their rooms. This is really a wonderful thing for the
Linux community. Whereas, the majority of student owned computers
on these networks are still running Windows 95, many students are
making the switch to Linux. One thing that newcomers to Linux are
constantly asking is, "Can I access a directory shared by a
Windows 95 computer in the 'Network Neighborhood', and can I
share files to Windows 95 users?" The answer, of course, is YES.
I keep trying to tell them that there is nothing that Linux can
not do, yet they continue to come to me and ask if they can do
this in Linux, or if they can do that. I have never once answered
no.
<h3>Samba</h3>
<p>To mount a Windows 95 share, we use a program called Samba. Samba
is a program that allows Linux to talk to computers running
Windows for Workgroups, Windows 95, Windows NT, Mac OS, and Novel
Netware. Samba even allows you to share a printer between
computers using these different operating systems. Samba comes
with most distributions of Linux, but if you do not have it
installed, you can obtain a copy from the Samba home page at
http://lake.canberra.edu.au/pub/samba/.
<h3>Mounting Windows 95 Shares</h3>
<p>The first thing you will probably want to do, is check to see
what directories are shared on the computer you are trying to
mount off of. To do this type smbclient -L computername. This
will list all the directories shared by the machine. To mount the
directory, we use the command smbmount. Smbmount can be a little
tricky though. I have created a script, named smb, that allows
users to mount drives using smbmount, with relative ease.
<pre> #usage smb computername sharename
#!/bin/sh
if [ $UID = 0 ]; then
if [ ! d /mnt/$1 ]; then
mkdir /mnt/$1
fi
#You may want to add the -u option here also if you need to
#specify a login id (ie: mounting drives on Windows NT)
/usr/sbin/smbmount //$1/$2 /mnt/$1 I $1 c etc
else
if [ ! d ~/mnt/ ]; then
mkdir ~/mnt/
fi
if [ ! d ~/mnt/$1 ]; then
mkdir ~/mnt/$1
fi
#You may want to add the -u option here also if you need to
#specify a login id (ie: mounting drives on Windows NT)
/usr/sbin/smbmount //$1/$2 ~/mnt/$1 I $1 c etcfi</pre>
<p>To execute this script you simply type smb followed by the name
of the computer you are mounting off of, and then the directory
you wish to mount (ex. smb workstation files). If you are root,
the script creates a directory in /mnt by the same name as the
computer, and mounts the directory there. For any other user, the
script makes a directory in the users home directory named mnt.
In that directory it makes another directory by the same name as
the computer and mounts the share there.
<h3>Sharing files with Windows 95</h3>
<p>Now to share a file. This also is not too difficult. To share a
directory you need to edit /etc/smb.conf. By default, Samba
shares users' home directories, but they are only visible (and
accessible) to the owner. This means that the person accessing
the share should be logged into Windows 95 with the same loginid,
as they use to log into your Linux box.
<p>Let's say you want to let 'bob' access the directory
'/shares/files', and you do not want anyone else to access it. To
do this, add these lines to your /etc/smb.conf file.
<pre> [bobsfiles]
comment = files for bob
path = /shares/files
valid users = bob
public = no
writable = yes
printable = no</pre>
<ol>
<li> indicates the name the directory will be shared under.
<li> is a comment that can be displayed in the Windows 95
Network Neighborhood.
<li> lists the directory on your computer that will be shared
<li> when set to yes allows users to access the directory with
guest privileges.
<li> indicates whether or not the user has write permissions to
the indicated directory
<li> when set to yes allows users to spool print jobs from that
directory
</ol>
<p>More examples on sharing files can be found in the default
smb.conf file. For more help on setting up this file, see the
Samba web page, or type man smb.conf.
<h3>More cool Samba stuff</h3>
<p>If a Windows 95 user on your network is running winpopup (an
instant massaging program), you can send them a winpopup message
using Samba. To do this just type <pre>smbclient -M computername
message_text</pre>.
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1997, Jonathon Stroud<BR>
Published in Issue 19 of the Linux Gazette, July 1997</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./python.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./lg_backpage19.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->