Introducion
I decided to get samba working between my linux box (`Edge') and my Windows 98
carcass (`Caffeine'). This was for a number of reasons:
- Transferring files between my Nokia 9110 and Edge used to be a complete
chore.
Moving files from the 9110 to Edge meant copying them to Caffeine's
c:\ drive and them FTPing them across. The hierachical tree in the Nokia
PC suite pretty much implies that it can detect other computers within the
'Network Neighbourhood' and let me drag and drop the files between the 9110
and Edge! This is much simpler, turning a two stage chore into something much
more simpler and quicker to do.
- Silly me bought a winprinter (a Lexmark 3200) and I wanted to see if I
could make use of it under Linux through some way or another.
I haven't gotten around to figuring out how to do this yet. Some other time...
Setting things up.
Naturally you need to have a TCP/IP network set up. I did this around the same
time that Kevin Lyda hosted his Installfeist, so I'm a little bit fuzzy about
the detais. All it involved was:
- Getting a crossover cat-5 cable for connecting the two PCs (I have noticed
that cat5 is much more robust than coaxial network cable).
- Slotting a network card into each of the machines
assigning IP numbers and a subnet mask to the cards (I used YaST to do this
under SuSE)
- Pinging the other machine to check things worked.
The next thing to do was to get samba installed and working, in hindsight this
wasn't all that difficult to do, though I must admit that I made a few silly
mistakes initially - reading the documentation (/usr/doc/packages/samba) helped.
To summarise though (if, like me, you couldn't be bothered to read
documentation most of the time) this is what you need to check:
Some tweaks and changes.
Essential things to do in Windows:
Once you have samba set up you will need to do a few things in Windows so you
can get around to making some use of it.
- Firstly you will need to open the Network settings:
- Rightclick on Network Neighbourhood and add the client 'Client for
Microsoft Networks', then select it as the Primary Network Logon client.
- Click on the Identification tab and ensure that the specified workgroup is
the same as that mentioned in the smb.conf file.
- Depending on the version of Windows that you have installed you should read
the Win95.txt file in the /usr/doc/packages/samba directory on your Linux
box - This is to do with Microsoft changing things around and now
encrypting the password, and also applies if you are using Windows 98.
Getting the 9110 involved.
When you reboot your windows box you should be able to log on (with your
Linux username and password) and see your Linux box in Network Neighborhood.
There are still a few more things that you will need to do if you want to
copy files straight from your 9110 to your 'user space' on the Linux box.
-
The Nokia PC Suite, as you will discover, does not display the computers
available in the Network Neighborhood in it's File Transfer window. It will
however display both the local and network/mapped drives of your Windows box.
Mapping your Linux folder to a drive is quite simple; what you need to do is
right click on whichever folder you want to use then click on 'Map Network
Drive', check the reconnect at logon box and finally click on the OK
button.
-
That done, when you start up the Nokia PC Suite next you will see that new
drive in the left pane (it is called "Ken on 'Edge'" in my case) and can
transfer files between your 9110 and Linux box more easily.
Sending a message.
There are a few other things that you can do with samba - one of them is to
send a message to all samba clients. This can be very handy if you want to
let them know that you have to restart Samba.
If they are using Windows to connect to your shares then they must be
running 'winpopup.exe' to recieve these messages.
You can configure Samba to
be the logon domain and use a log on script to start winpopup.exe
automatically, however this is overkill for a simple home network. It's
simpler to just have a shortcut to winpopup in the Startup group.
You can use smbclient to send messages (with the -M arugment to specify which
machines you want the message to go to). Or you could use the samba wall
script (wall.perl) which is available in
/usr/doc/packages/samba/examples/misc. (The wall command writes a message to
the screens of all people that are logged in to your linux box - wall.perl
is the equivalent for Samba clients.)
I had to make a few changes to wall.perl so that it would work for me - you can download it from the downloads section.
Once you have the script renamed to smb-wall and set it's executable
permission (chmod 755 smb-wall) you can send a test message:
$smb-wall
What are you using Windows for?
.
You can also use smb-wall to send a message to a specified client with
smb-wall caffeine (where caffeine is the name of the client tht you want
the message sent to.)
Smb-wall can handle piped input, so something like the following should
work just fine:
echo "Pinging!" | smb-wall caffeine; ping caffeine
You should be aware that the name of the machine that you specify to smb-wall
must be the primary name of the machine (i.e. not an alias). So, for example,
this would work on my network at home:
$smb-wall caffeine.zed
quick test
.
but this would not, even though gw has the same IP number as caffeine:
$smb-wall gw.zed
this will not get through
.
Other uses of smbclient
-
It is possible to connect to a shared Windows drive ala ftp and transfer files
to or from it in the same manner that you would use a command line ftp
client.
smbclient \\\\CAFFEINE\\ZIP creates a samba connection to the ZIP drive that I
have attached to my Windows 98 box. It's important to know that smbclient will
prompt you for a password, even if the shared folder does not have a password
shared against it in windows. I've found that random passwords will work just
fine.
Typing help at this point will cause a list of smbclient commands, quite
similar to ftp's, to be displayed
ilug@Edge:/home/ilug > smbclient \\\\CAFFEINE\\ZIP
Added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0
Server time is Mon Nov 22 23:03:04 1999
Timezone is UTC-0.0
Password:
security=share
smb: \> help
ls dir lcd cd pwd
get mget put mput rename
more mask del rm mkdir
md rmdir rd pq prompt
recurse translate lowercase print printmode
queue qinfo cancel quit q
exit newer archive tar blocksize
tarmode setmode help ? !
smb: \> put nokiappp.txt
putting file nokiappp.txt of size 945 bytes as \nokiappp.txt (38.452 kb/s)
(average 38.4521 kb/s)
There is a much better way of moving files to a different computer using the
Samba (smb) protocol under Linux. That is to use
kruiser, a KDE file manager,
which used to be called KExplorer.
-
You can use smbclient to retrieve a list of the services (e.g. printers and
diskspace) that are available on a machine (this is equivalent to net
view \\CAFFEINE under DOS).
Handy if you can't quite remember the name of whatever service it is that you want to use. E.g.
ilug@Edge:/home/ilug > smbclient -L caffeine -I caffeine
Added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0
Server time is Mon Nov 22 23:28:06 1999
Timezone is UTC-0.0
security=share
Server=[CAFFEINE] User=[] Workgroup=[CENTRAL] Domain=[CENTRAL]
Sharename Type Comment
--------- ---- -------
IPC$ IPC Remote Inter Process Communication
NOSMARTS Printer damned winprinter
PRINTER$ Disk
ZIP Disk ZIP
ilug@Edge:/home/ilug >
And that, I think, is the perfect opportunity for me to wrap this up!
The Declan clause.
This tutorial was written by Ken Guest, http://technobrat.net.
Copyright © Ken Guest 1999.
Publication of this work in any printed or electronic form in part or in whole for non private use without (a) the inclusion of the above copyright notice (b) written permission of the author is an infringement of copyright and thus prohibited by law and international convention.
Also by Ken Guest
- viM Tutorial; an introduction to vi and ViM.
- viM Tutorial #2, covering Search & Replace, filters and a few more tricks.
Please tell us what you thought of this tutorial:
|