USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

mini-howto: Making Windows work with Linux on your network
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Networking
View previous topic :: View next topic  

Was this helpful?
Yes, thanks
95%
 95%  [ 22 ]
No, it s****
4%
 4%  [ 1 ]
Total Votes : 23

Author Message
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Tue Mar 09, 2024 2:29 pm    Post subject: mini-howto: Making Windows work with Linux on your network Reply with quote

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 Smile




Last edited by nukes on Fri May 28, 2024 3:11 pm; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
mr_ed
Site Admin


Joined: 28 Aug 2024
Posts: 3819
Location: 42 miles north of Ogdensburg, NY

PostPosted: Tue Mar 09, 2024 2:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
crouse
Site Admin


Joined: 17 Apr 2024
Posts: 11833
Location: Iowa

PostPosted: Tue Mar 09, 2024 4:55 pm    Post subject: Reply with quote

Very nice Cool


Back to top
View user's profile Send private message Visit poster's website AIM Address
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Thu May 20, 2024 10:09 am    Post subject: Reply with quote

Just came in handy for me setting up my box to print again. Smile
I think we can un-sticky this now Very Happy


Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
geeshock
Moderator


Joined: 02 Nov 2024
Posts: 1017
Location: Hertford, NC

PostPosted: Tue May 25, 2024 1:59 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Tue May 25, 2024 2:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
JP
Linux Guru


Joined: 07 Jul 2024
Posts: 6670
Location: Central Montana

PostPosted: Sun Jul 11, 2024 7:31 pm    Post subject: Samba Mini-How to Reply with quote

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
View user's profile Send private message Visit poster's website
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Mon Jul 26, 2024 9:05 pm    Post subject: Reply with quote

1. You can just use the IP. /etc/hosts is a host list to resolve names to IP addresses. So if you wanted 192.168.5.13 to have the name "foobarbox" you would add the following line in the /etc/hosts file:
Code:
192.168.5.13 foobarbox

2. The share name is the name of the share you're connecting to on the remote computer. In the properties box in explorer there's a sharing tab. There you can set the share name. By default on NT based systems the root directories of each hard disk are shared with the names c$, d$, e$ etc. You need to log in as administrator to access them.
3. The mount point is the directory you want to be able to access the share on the Linux computer. i.e. I mount the documents share on my fileserver under /mnt/network/documents.

As to installing Samba, your best bet would be to use an RPM. I don't use 'drake so I couldn't tell you where to find one on the web. Ask Germ or someone. Smile

Hopefully that's cleared some of it up for you. If not, post back Very Happy



_________________
Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
JP
Linux Guru


Joined: 07 Jul 2024
Posts: 6670
Location: Central Montana

PostPosted: Tue Jul 27, 2024 3:00 am    Post subject: Reply with quote

Welcome back! Very Happy Thanks for the info, now I'll digest it and see if I can make it work. Then, when I have more questions, I will post again. THX, JP Smile



_________________
Dell Box - Arch Linux
Dell Lappy - DreamLinux 3.5 - Default OS
Mepis 8.0 - Backup
Back to top
View user's profile Send private message Visit poster's website
mmmna
. . . .


Joined: 21 Apr 2024
Posts: 7224

PostPosted: Fri Aug 06, 2024 4:00 am    Post subject: Reply with quote

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 2024 LXDE on EeePC 900A with Atom n270 (modded with 32G SATA drive and 2G ram).
Back to top
View user's profile Send private message
mushroom
Ultimate Member


Joined: 29 Jun 2024
Posts: 2129
Location: Queen Charlotte B. C. Canada

PostPosted: Fri Aug 06, 2024 7:09 pm    Post subject: Quick and Simple Reply with quote

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
Code:
smb://Ip_address/

Your there, but only from the Linux Box.


Back to top
View user's profile Send private message Visit poster's website
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Sat Aug 07, 2024 11:45 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Tue Sep 07, 2024 9:40 pm    Post subject: Reply with quote

Who made this sticky again?



_________________
Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Xeroid
Site Admin


Joined: 19 Apr 2024
Posts: 6456
Location: Georgia

PostPosted: Tue Sep 07, 2024 10:15 pm    Post subject: Reply with quote

Nukes wrote:
Who made this sticky again?


Me Laughing

It wasn't in the tutorial thread and I had a hard time finding. I needed it so I made it sticky so it wouldn't be so hard to find next time. Very Happy

Do you think this is at a point where we could put it in the tutorial thread or do you want to work on it some more?



_________________
Ubuntu 10.04 . . . Kernel-2.6.32-22
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Germ
Keeper of the BIG STICK


Joined: 30 Apr 2024
Posts: 12452
Location: Planet Earth

PostPosted: Tue Sep 07, 2024 11:02 pm    Post subject: Reply with quote

Looks great to me. Sorry, Nukes. I missed this when I was re-doing the tutorial links. Embarassed



_________________
Laptop: Mandriva 2024 PowerPack - 2.6.33.5-0.2mnb
Desktop: Mandriva 2024 Free - kernel 2.6.33.2-1mib
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Networking All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse