View previous topic :: View next topic |
Was this helpful? |
Yes, thanks |
|
95% |
[ 22 ] |
No, it s**** |
|
4% |
[ 1 ] |
|
Total Votes : 23 |
|
Author |
Message |
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
Posted: Tue Mar 09, 2025 2:29 pm Post subject: mini-howto: Making Windows work with Linux on your network |
|
|
Using Samba for Windows-Linux interoperability.
Samba is a server for the SMB (Server Message Block) protocol.
It is the protocol used by Windows for "File and Print Sharing". Samba is one of
the programs that has most helped raise Linux's profile, in that it can be used
as a server for Windows machines - And a good one at that!
Currently I run a Samba server for my network on Debian, however it comes in
useful for other things.
In this mini-howto I'm going to cover the following things;
1. Accessing a Windows share from Linux
2. Setting up a simple samba share on Linux
3. Accessing a Linux share from Windows
4. Printing to a printer that's on a Windows machine via CUPS.
I assume a basic understanding of how windows networking works, i.e. lmhosts (the windows equivalent of /etc/hosts), netbios names and workgroups, and WINS (netbios name resolution) There are plenty of resources availiable for this, and I'm not re-inventing the wheel.
First of all then, Accessing a windows share from Linux.
You will need the following information:
1. The name or IP address of the Windows machine you're connecting to. If you
have the name, it must be set in /etc/hosts or accessible via a WINS server set
up in /etc/samba/smb.conf
2. The name of the share.
3. The username and password of the account you wish to connect as (this is the
user/pass for the WINDOWS machine)
4. A mount point.
Right, lets assume you have a computer called "files" and a share called
"documents", you want to login as richard, and mount it as
/mnt/network/documents.
Code: |
mount -t smbfs -o rw,username=richard //files/documents mnt/network/documents |
This should give you the following output:
Code: | root@nexus richard # mount -t smbfs -o rw,username=richard /files/documents /mnt/network/documents
Password:
root@nexus richard #
|
The directory is then mounted and you can read/write to it as root. But what if
you want access to it as a normal user?
Then you have to make sure your user has write permissions to the mount point,
and add in a umask option to suit you. If you don't know what a umask is, you
could use umask=0 but it can be a security implication as every user on the
system will have write access to the share.
just FYI adding a umask=0 would look like this:
Code: |
mount -t smbfs -o rw,umask=0,username=richard //files/documents /mnt/network/documents |
Now that should work ok. Lets say you didn't want to have to type that every
time you want to mount the share. You can add an entry in /etc/fstab:
Code: | //files/documents /mnt/network/documents smbfs rw,umask=0,username=richard 0 0 |
If you're really lazy you could add a password= bit to the options, but I
wouldn't recomend that. It would mean anyone on the system with read access to
/etc/fstab (which is normally world-readable btw) could get access to your
windows password.
Setting up a simple Samba Share in Linux
Ok, for this you're going to hae to whip out the screen editors. The file we're
looking at is /etc/samba/smb.conf. If you use a distro that provides GUI tools
for this, then use them (unless you want to do it the harder way)
There is also a plugin for Kcontrol (KDE control centre) which claims to be able
to edit EVERY option in the smb.conf file without mutilating it. Its still in
development, and I haven't personally tested it as I don't use such things, but
it looks like it will be good for people who don't like that sort of thing.
http://ksambakdeplugin.sourceforge.net/
Anyway, for the rest of us, lets get on with it. Remember that this is meant to
be a very basic guide. Samba is capable of things you probably didn't know
existed.
First things first, look at the example file and change as much of it as
possible to suit your network. This includes the following fields:
workgroup
netbios name
hosts allow
security
wins server (if you have one)
Now, at the bottom, there should be some example shares like this:
Code: |
;[myshare]
; comment = Mary's and Fred's stuff
; path = /usr/somewhere/shared
; valid users = mary fred
; public = no
; writable = yes
|
I'll talk you through the options here:
the [myshare] bit is the share name.
the comment is the comment field
the path is the UNIX path to the share.
the valid users bit is which users have access to the share.
the public is whether or not everyone can access it. If you want everyone
to be able to, there's little point setting the valid users bit.
Finally, writeable is if people can write to the share.
Just set these to your values, and remove the ";" at the start of each line.
Then you should be able to access it from a windows box or a Linux system using
the method above.
3. Accessing a Linux share from Windows
This is just the same as accessing a share on another windows system. The only
difference is that you may need to specify the IP of the Linux server, or add it
into LMHOSTS to get it to resolve depending on the versions of software in use.
4. Printing to a printer that's on a Windows machine via CUPS.
For this exercise, you're going to need a few extras.
1. CUPS installed (and probably Ghostscript and foomatic as well)
2. a PPD file from www.linuxprinting.org for your printer.
3. The name of the printer share and the machine its connected to.
1 and 3 should be pretty self explanatory. No. 2 may not be so I'll elaborate:
The ppd file describes the format of data that needs to be sent to the printer.
Its sort of a config file for the driver (which gets provided with CUPS and
GhostScript) Linuxprinting.org has a pretty easy to follow interface, and you
just search for your printer model and put the ppd file you downloaded in
/usr/share/cups/model/
(if you still can't find where to get the PPD for your printer, use
http://www.linuxprinting.org/printer_list.cgi )
Now you start the CUPS daemon with the appropriate init script, like so:
Code: | richard@nexus richard $ su
Password:
root@nexus richard # /etc/init.d/cupsd start
* Starting cupsd... [ ok ]
root@nexus richard #
|
And point your web browser at:
http://localhost:631
Click "Do administration tasks" and login as root.
Click "Add printer"
Enter a few strings to suit yourself and click continue.
On the next screen, select Windows Printer via SAMBA and click continue.
The device URL is a bit more complicated. Use this format:
smb://username:pass@workgroup/host/printer
username is your username on the windows box
pass is the password
workgroup is the workgroup name
host is the NetBIOS machine name
printer is the share name of the printer.
Then click continue again.
Next screen, select the maker of your printer, click continue, then the model of
the printer, and continue again. Hopefully it should work now.
To print a test page, go to "Administration" then "Manage Printers"
There should be an option next to each printer to print a test page. There you
go now, you've sucessfully integrated Linux onto your windows network 
Last edited by nukes on Fri May 28, 2025 3:11 pm; edited 3 times in total |
|
Back to top |
|
mr_ed Site Admin

Joined: 28 Aug 2025 Posts: 3819 Location: 42 miles north of Ogdensburg, NY
|
Posted: Tue Mar 09, 2025 2:44 pm Post subject: |
|
|
As soon as I have time to go through it, I'll cast my vote!
_________________ Desktop: Ubuntu 7.10 "Gutsy Gibbon"
Laptop: Ubuntu 7.04 "Feisty Fawn"
|
|
Back to top |
|
crouse Site Admin

Joined: 17 Apr 2025 Posts: 11833 Location: Iowa
|
|
Back to top |
|
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
|
Back to top |
|
geeshock Moderator

Joined: 02 Nov 2025 Posts: 1017 Location: Hertford, NC
|
Posted: Tue May 25, 2025 1:59 am Post subject: |
|
|
It was prety good, I wouldn't mind seeing information on using samba as a PDC wich if I heard corectly, it can do now, or even as a BDC.
|
|
Back to top |
|
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
Posted: Tue May 25, 2025 2:46 pm Post subject: |
|
|
It was able to act as a PDC in 2.x, but the BDC functionality came in 3.0 IIRC.
The official samba docs are much more detailed, complete and well written, this was just intended to be a quick guide to the most common tasks that people want.
http://samba.mirror.ac.uk/samba/docs/
The comments in the config file will help a lot in setting up a PDC, but I'd advise you to at least read through the docs first. It isn't quite as easy as running dcpromo on a windows box.
_________________ Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
|
|
Back to top |
|
JP Linux Guru

Joined: 07 Jul 2025 Posts: 6670 Location: Central Montana
|
Posted: Sun Jul 11, 2025 7:31 pm Post subject: Samba Mini-How to |
|
|
I have a question or two about Samba. I have downloaded some files that I would like to burn on my windows machines. They are already able to communicate on a lan, but I can't get my Mandrake box or my Debian box to communicate with any of them. I can get on the Internet with the Linux boxes, but can't communicate with the Win boxes. I have DSL, and all machines are hooked to the DSL modem via a Linksys 4 port router. On my Mandrake box I tried to download the Samba package, but it tells me that the files are bad and won't install. I looked on the Mandrake errata page and they have a patch, but to install the patch, I have to re-install the OS (from what I can figure). Is there any way that I can find a tutorial like this that will give step-by-step instructions for downloading direct from Samba.org, unwrapping it, compiling it (or whatever else has to be done) to put it onto my Mandrake box without having to lose all the downloads I have got?
*****I ended up having to wipe out the Mandrake because of other problems, so now I have Mandrake 10. It's the download edition and is 3 CD's. Samba is on Disk 4! *****
My Linux box downloads about twice as fast as my Win box, so I'd like to download on it and share to the one Win box to burn. If you need more info, just let me know.
Also, in your tutorial above you say, after "Accessing a Windows Share from Linux;"
You will need the following information:
1. The name or IP address of the Windows machine you're connecting to. If you have the name, it must be set in /etc/hosts or accessible via a WINS server set up in /etc/samba/smb.conf
~~~~~ In Point 1, I have the name and IP address, but how do I "set" it in /etc/hosts? Is there a command that I should know, or is that the code you show lower down in the page?
Code:
mount -t smbfs -o rw,username=richard //files/documents mnt/network/documents ~~~~~
2. The name of the share.
~~~~~~~~~What name is this?~~~~~~~~~~
3. The username and password of the account you wish to connect as (this is the
user/pass for the WINDOWS machine)
4. A mount point.
~~~~~~ Is this the directory that it is in? or where it is going? ~~~~
****** I have downloaded Samba from Samba.org, and it is in my " /home/JP/documents/samba-latest.tar.gz" *******
Sorry to be such a pest, but I really would like to learn Linux and be able to do it right, not just fumble arund in the dark. Thanks, JP
|
|
Back to top |
|
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
|
Back to top |
|
JP Linux Guru

Joined: 07 Jul 2025 Posts: 6670 Location: Central Montana
|
|
Back to top |
|
mmmna . . . .

Joined: 21 Apr 2025 Posts: 7224
|
Posted: Fri Aug 06, 2025 4:00 am Post subject: |
|
|
This is one of those threads I wish I had seen when it was first posted.....
_________________ -Kubuntu 10.04 LTS Beta2 on Celeron D desktop
-PCLinuxOS 2025 LXDE on EeePC 900A with Atom n270 (modded with 32G SATA drive and 2G ram).
|
|
Back to top |
|
mushroom Ultimate Member

Joined: 29 Jun 2025 Posts: 2129 Location: Queen Charlotte B. C. Canada
|
Posted: Fri Aug 06, 2025 7:09 pm Post subject: Quick and Simple |
|
|
If your window's shares are R-W with no password and samba is running ( no configuration required).
Open Konqueror and in the address field type
Your there, but only from the Linux Box.
|
|
Back to top |
|
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
Posted: Sat Aug 07, 2025 11:45 am Post subject: |
|
|
Yeah, that's a handy feature if you use KDE.
You can also use the hostname/netbios name of the machines instead of the IP.
_________________ Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
|
|
Back to top |
|
nukes Linux Guru

Joined: 29 Aug 2025 Posts: 4558
|
Posted: Tue Sep 07, 2025 9:40 pm Post subject: |
|
|
Who made this sticky again?
_________________ Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
|
|
Back to top |
|
Xeroid Site Admin

Joined: 19 Apr 2025 Posts: 6456 Location: Georgia
|
|
Back to top |
|
Germ Keeper of the BIG STICK

Joined: 30 Apr 2025 Posts: 12452 Location: Planet Earth
|
|
Back to top |
|
|