Seeing Samba shares from windows


Forum: Networking
Topic: Seeing Samba shares from windows
started by: Oostertoaster

Posted by Oostertoaster on June 13 2005,13:59
I have recently resurrected by legacy PC with DSL, and I am now trying to set it up as a file server (essentially a mass storage device or external hard drive.  ITs all the PC is good for anymore, really.)

Some specs on the PC:
83 MHz Pentium overdrive
64 Megs of Ram
2 harddrives (one 13.6 gig, one 6.5 gig)
the hard drives are split into 2 gig partitions because the bios is so old, that is all it can read (apparently).
DSL is installed on the HD (its own 2 gig partition on the 6.5 gig drive.)

The network card is configured correctly, obtains an ip address via the router, etc.  I can even see the linux box from the Windows XP laptop.  HOwever, when I try to access one of the shared drives, it says I do not have permission to utilize that network resource.  Its quite frusterating.  I added my username and password to the passwd file, which is why I can see the shares in the first place, I believe.  How do I obtain permissions to use the shares?  

(I'm attempting to share entire partitions, if that makes a difference.  The way I've got it set up now, I'm trying to share 3  seperate FAT parititions, all of them at 2 gigs each.  This shouldn't be that big of a problem though.)

Please help, this is becoming a very frusterating project.  If I don't figure this out soon, I'll go insane.

Posted by mikshaw on June 13 2005,15:16
Don't know how much this helps, but this is what i have in smb.conf that allows windows users to write to a share called "shared" (on suse):
[global]
       netbios name = BUNGLE
       server string = Samba Server
       interfaces = eth0
       encrypt passwords = Yes
       map to guest = Bad User
       time server = Yes
       unix extensions = Yes
       socket options = SO_KEEPALIVE IPTOS_LOWDELAY TCP_NODELAY
       printcap name = CUPS
       os level = 2
       local master = No
       domain master = No
       hosts allow = 192.168.1.101,192.168.1.102
       nt acl support = No
       printing = cups
       veto files = /*.eml/*.nws/riched20.dll/*.{*}/

[shared]
       comment = Network Share
       path = /home/shared
       read only = No
       create mask = 0644
       guest ok = Yes

Some of it is default settings that i couldn't explain.
I think the "encrypt passwords" option is particularly important for windows machines.

Posted by tempestuous on June 14 2005,03:33
DSL has a small network utility - smbclient, which lets Linux see Windows directories, and exchange files in an "ftp-like" manner.
But for Windows to see Linux you need the full Samba package.  You can download it from the mydsl section.
Then there's quite a bit of configuration involved.  Here goes -

From Windows you will need to supply a username and password to access the Linux box.  Decide whether you want this to be an existing username, or create a new user for the purpose of sharing.  Let's say we make a new user called "shareuser", password "helloworld", SMB password "helloshare".  Do this -
adduser shareuser
Enter new UNIX password: helloworld
smbpasswd -a shareuser
password: helloshare

Now edit your samba configuration file - /etc/samba/smb.conf
in the [global] section,
workgroup = yourworkgroupname

In  ## Authentication ## section
encrypt passwords = yes

In Share Definitions section, comment out all existing shares.  Add:
[shareuser]
comment = Windows Share
path = /home/shareuser
read only = no
Uncomment  writable = no
Change 2x permissions masks to 0775

Now after you start these 2 daemons -
/usr/sbin/smbd -D
/usr/sbin/nmbd -D
Windows should be able to browse the /home/shareuser directory.
Some applications automatically start these daemons (LinNeighborhood?)
Craig S

Posted by Oostertoaster on June 16 2005,11:56
I'm still having troubles getting this to work.  My smb.conf file is very similiar to the suggested ones above.  Also, the proper daemons have started already (smbd, nmbd) and are running.  smbclient registers the proper shares (/dev/hdb5 and /dev/hdb6)

However, when I try to mount the shares from my XP laptop or Win98SE box, I get a dialog that says I do not have permission to use that resource (Despite adding proper permissions to the passwd file and using chmod to modify the permissions, etc.)  

To see if the problem was isolated to my windows boxes, I tried to mount the shares on the linux box themselves in LinNeighborhood (kind of circular, mounting a share to the machine that is sharing it, but I wanted to see if Linux was able to mount the share.)  This doesn't work either! It says I have the incorrect password (Can't remember the exact dialog box, and I'm posting this from work.  When I get home I'll run it again and get exact wording if needed.)  

So, because of this I'm assuming I have some sort of authentication/password problem.  But I'm pretty new to linux in general (and even newer to DSL in particular).  Anyone have any further ideas?  I'd really appreciate it.

EDIT: One thing I thought of, my smb.conf file has no "create mask= " lines.  Are those necessary? It already has "public=yes" and "guest =ok".

Posted by mikshaw on June 16 2005,15:03
create mask is for setting permissions on files that the user creates in a particular share. It should have no impact on whether or not the user can initially log in.

Maybe the "hosts allow" and "encrypt passwords" options should be checked.

Posted by tempestuous on June 19 2005,08:13
Before you attempt to set up sharing for the 3 partitions, I suggest you just try to share a local directory - something like /home/shareuser as above.
Use Windows Explorer to browse to the Linux box.  When you double-click the share folder  you will be prompted for a username and SMB password.
Windows XP firewall is off, right!
Once you know the system is working, now go ahead and create another 3 share definitions in the smb.conf file.
The "path" entries must be the correct file system paths of your partitions - /mnt/hdb5 /mnt/hdb6 (& /mnt/hda2 ?)  And of course, these partitions must be mounted.
Then restart samba, or reboot.

Posted by Guest on June 24 2005,01:04
Some things to try:

1) open a terminal and run testparm.  Are you getting any errors?

2) make sure NMBD and SMBD were running when you did your smbpasswd -a

3) make life simple, do an sudo smbpasswd -a dsl
when you're asked for the password just hit Enter

4) from your windows box when you try to view the dsl shares use the userid of dsl and see if that gets you any further (don't enter anything for the password).

this might have security problems in a business but for home use it's probably fine.

Posted by pmk on Aug. 13 2005,22:56
I am following tempestuous howto near the beginning of this thread.  I also do a "sudo su" before doing anything and I start with a fresh install each time.

When I do the "smbpasswd -a shareuser" it returns an error "unable to open passdb database, added user shareuser" (have also tried this after running the NMBD and SMBD commands and I still get the same error)

I also get errors at the following two lines in smb.conf.  I am guessing these should not be put in the [shareuser] section of smb.conf?

Uncomment writable = no (where do I do this I have commented out everything in the share area?)

Change 2x permissions masks to 0775 (Using a terminal and chmod? What files am I changing the permissions for?)

Both these lines above fail the testparm command.  It also says ERROR lock directory /var/locks does not exist and ERROR pid directory /var/locks does not exist.

Can anyone help further I am tearing my hair out!?

TIA

Posted by tempestuous on Aug. 14 2005,09:06
I'm using Samba right now between my Windows desktop computer and my Linux laptop, but I must point out that the laptop has a hard drive install of Knoppix 3.4 - DSL's "parent" distribution.  So I can't comment on the Samba package available for DSL.
[/QUOTE]"unable to open passdb database, added user shareuser"[QUOTE]
Check that you have /etc/samba/smbpasswd, and if so, check its permissions, and check that this file is listed in /etc/samba/smb.conf.  Below is a version of smb.conf which should be correct.

;
; /etc/samba/smb.conf
;
; Sample configuration file for the Samba suite for Debian GNU/Linux
;
; Please see the manual page for smb.conf for detailed description of
; every parameter.
;

[global]

# Do something sensible when Samba crashes: mail the admin a backtrace
  panic action = /usr/share/samba/panic-action %d
  printing = cups
  printcap name = cups
  load printers = yes
  guest account = nobody
  invalid users = root

; "security = user" is always a good idea. This will require a Unix account
; in this server for every user accessing the server.
  security = user

; Change this for the workgroup your Samba server will part of
  workgroup = YOURWORKGROUP

  server string = %h server (Samba %v)

; If you want Samba to log though syslog only then set the following
; parameter to 'yes'. Please note that logging through syslog in
; Samba is still experimental.
  syslog only = no

; We want Samba to log a minimum amount of information to syslog. Everything
; should go to /var/log/{smb,nmb} instead. If you want to log through
; syslog you should set the following parameter to something higher.
  syslog = 0;

; This socket options really speed up Samba under Linux, according to my
; own tests.
  socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=4096 SO_RCVBUF=4096

; Passwords are encrypted by default. This way the latest Windows 95 and NT
; clients can connect to the Samba server with no problems.
  encrypt passwords = true
  passdb backend = smbpasswd guest

; It's always a good idea to use a WINS server. If you want this server
; to be the WINS server for your network change the following parameter
; to "yes". Otherwise leave it as "no" and specify your WINS server
; below (note: only one Samba server can be the WINS server).
; Read BROWSING.txt for more details.
  wins support = no

; If this server is not the WINS server then specify who is it and uncomment
; next line.
;   wins server = 172.16.0.10

# If we receive WINS server info from DHCP, override the options above.
  include = /etc/samba/dhcp.conf

; Please read BROWSING.txt and set the next four parameters according
; to your network setup. There is no valid default so they are commented
; out.
;   os level = 0
;   domain master = no
;   local master = no
;   preferred master = no

; What naming service and in what order should we use to resolve host names
; to IP addresses
  name resolve order = lmhosts host wins bcast

; This will prevent nmbd to search for NetBIOS names through DNS.
  dns proxy = no

; Name mangling options

  preserve case = yes
  short preserve case = yes

; This boolean parameter controlls whether Samba attempts to sync. the Unix
; password with the SMB password when the encrypted SMB password in the
; /etc/samba/smbpasswd file is changed.
  unix password sync = false

; For Unix password sync. to work on a Debian GNU/Linux system, the following
; parameters must be set (thanks to Augustin Luton
; <aluton@hybrigenics.fr> for sending the correct chat script for
; the passwd program in Debian Potato).
  passwd program = /usr/bin/passwd %u
  passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .

; The following parameter is useful only if you have the linpopup package
; installed. The samba maintainer and the linpopup maintainer are
; working to ease installation and configuration of linpopup and samba.
;   message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

; The default maximum log file size is 5 MBytes. That's too big so this
; next parameter sets it to 1 MByte. Currently, Samba rotates log
; files (/var/log/{smb,nmb} in Debian) when these files reach 1000 KBytes.
; A better solution would be to have Samba rotate the log file upon
; reception of a signal, but for now on, we have to live with this.
  max log size = 1000

  obey pam restrictions = yes

; Some defaults for winbind (make sure you're not using the ranges
; for something else.)
;   winbind uid = 10000-20000
;   winbind gid = 10000-20000
;   template shell = /bin/bash

; ISOLATIN1 with euro sign
unix charset = iso-8859-15
display charset = iso-8859-15
dos charset = 850

[homes]
  comment = Home Directories
  browseable = no

; By default, the home directories are exported read only. Change next
; parameter to "no" if you want to be able to write to them.
  read only = yes

; File creation mask is set to 0700 for security reasons. If you want to
; create files with group=rw permissions, set next parameter to 0775.
  create mask = 0775

; Directory creation mask is set to 0700 for security reasons. If you want to
; create dirs. with group=rw permissions, set next parameter to 0775.
  directory mask = 0775

[shareuser]
comment = Windows Share
path = /home/shareuser
read only = no

[print$]
  comment = Printer Drivers
  path = /var/lib/samba/printers
  browseable = yes
  guest ok = no
  read only = yes
  write list = knoppix

[printers]
  printer admin = knoppix
  comment = All Printers
  browseable = no
  path = /tmp
  printable = yes
  public = no
  writable = no
  create mode = 0700

; A sample share for sharing your CD-ROM with others.
;[cdrom]
;   comment = Samba server's CD-ROM
;   writable = no
;   locking = no
;   path = /cdrom
;   public = yes
;
; The next two parameters show how to auto-mount a CD-ROM when the
; cdrom share is accesed. For this to work /etc/fstab must contain
; an entry like this:
;
;       /dev/scd0   /cdrom  iso9660 defaults,noauto,ro,user   0 0
;
; The CD-ROM gets unmounted automatically after the connection to the
;
; If you don't want to use auto-mounting/unmounting make sure the CD
; is mounted on /cdrom
;
;   preexec = /bin/mount /cdrom
;   postexec = /bin/umount /cdrom

Posted by pmk on Aug. 14 2005,09:23
Thanks tempestuous I will give it a go.  I am reinstalling Windows as I am completely at a loss why what I have already tried does not work.

Do I need to worry about:

1. What do you mean by check that this file is listed in /etc/samba/smb.conf?
2. the pid and lock errors?

Does Knoppix work out of the box or is it simplier with setting up Samba?

TIA

Posted by tempestuous on Aug. 14 2005,14:03
The smbpasswd utility, /usr/bin/smbpasswd, is trying to write to the Samba password database file (which confusingly is also called "smbpasswd") at /etc/samba/smbpasswd, and fails.  I see no obvious reason and solution.

Maybe you could try another Linux distribution, or a different version of Samba.  The quickest way to achieve this would be to install the dpkg.dsl package, then install Samba from deb files from < http://packages.debian.org/unstable/net/samba-common > and < http://packages.debian.org/unstable/net/samba >

Yes, Knoppix works out-of-the-box, but Samba configuration should be exactly the same.
Knoppix and DSL are related, but they're very different.  Knoppix is a full-featured distribution with almost every application you could want, but it's a full 3GB when installed to hard drive and its default KDE window manager makes it slow on older computers.  It works better when its window manager is changed to Xfce or IceWM or Fluxbox.  I use Knoppix as a development environment for DSL.
DSL is small, fast, and can be quickly set up on different computers.

If you're only concerned with a single, permanent installation you might consider a "middleweight" distribution like Mepis (Debian-based) or Vector (Slackware-based).

Posted by pmk on Aug. 14 2005,18:05
Thanks for trying to help.  I am at a loss on why it is not working.  It is not like I have not setup Samba before but its a long time ago and obviously I am forgetting to do something simple and it was in a more complete distribution.

Do you know of an easy way of installing SWAT as my last attempt to get it working?

TIA

Posted by pmk on Aug. 14 2005,18:38
>Thanks for trying to help.  I am at a loss on why it is not
>working.  It is not like I have not setup Samba before but
>its a long time ago and obviously I am forgetting to do
>something simple and it was in a more complete distribution.
>Do you know of an easy way of installing SWAT as my last >attempt to get it working?

Following up am I using the correct Samba download?  MyDSL - Net button - samba.dsl then OK to /tmp and Download?

This creates a LnNeiborhood.  I can use this to successfully see the hidden Windows shares on my Windows machine (e.g. C$) but whatever I do it does not let my Windows machine see the Linux machine.

If I wanted to go straight to the Linux box in case the Windows is not displaying the machine for some reason is it

\\box\shareuser in the address field in Windows or is box wrong and it should be \\dsl or something?

I can get everything else i need working apart from Samba.  If you (or anyone else who may know whats wrong) can help further to help me diagnose the problem it would be greatly appreciated?

TIA

Posted by pmk on Aug. 14 2005,19:05
Sorry to post again but I may have found the problem but I do not know how to fix.  When I use LnNeighbourhood and update the Workgroup field to WORKGROUP and Save my smb.conf file in /etc/samba does not get updated but WORKGROUP is remembered in the LnNeighbourhood field could I be editing the wrong /etc/samba file? (Linux -> Windows seems to still be working with the hidden shares C$ but Windows -> Linux is still not working the Linux box does not even appear in the Windows Network Neighbourhood window?)

TIA

Posted by tempestuous on Aug. 15 2005,01:05
\\box\shareuser is correct.

Your Samba configuration file might be found at /etc/samba/smb.conf or /etc/smb.conf ... or perhaps BOTH ... which would then explain some of your problems.

Posted by ke4nt1 on Aug. 15 2005,01:14
Hmm.. my samba config file is found at /opt/samba/smb.conf  ..

Works for me..

73
ke4nt

Posted by pmk on Aug. 15 2005,13:59
Can someone tell me what should be running in "ps -ax" to confirm that Samba is running so Windows can see Linux?

I have tried "sndb -D" and "nmbd -D" but even after running these they do not output anything to the shell window and "ps -ax" does not list them?

Trying with smb.conf in the /opt/samba folders at the moment at that is what LnNeighbourhood seems to use.

Any further help much appreciated.

TIA

Posted by tempestuous on Aug. 15 2005,15:55
I guess the smb.conf file is at /opt/samba/ because Samba was installed from a dsl package.
It sounds like you're getting closer.  Just a few points -

LinNeighborhood provides a gui to access Windows from Linux.  It is not involved when you are accessing Linux from Windows.  And it has its own configuration file separate from smb.conf - /home/dsl/.LinNeighborhood/preferences.  This may contain the line "workgroup = WORKGROUP" but this is not a fixed parameter, it just provides this text in the gui, which you can change prior to logging onto the Windows client.

If you are using DHCP, you need to do a full DHCP negotiation with "pump -i eth0", not just "ifup eth0" or "ifconfig eth0 up".
Or if you are setting up a static address, you may need to specify other parameters to ifconfig as well as the IP address, namely broadcast address and netmask.

One simple way to know if smbd and nmbd are working is that when they are running, LinNeighborhood will not only see the Windows machine, but also see itself!

Posted by cronus on Oct. 30 2005,04:08
DO make sure the firewall on windows system, if any, to authorize the connection to dsl box. I got the same problem and sovled in this way.
Posted by kuky on Nov. 09 2005,17:12
i run samba and i can see linux to windows 98se, linux to linux no and windows to linux no.

the workgroup is ok in smb.conf and .lin... is ok who is wrong ? i suposed in smb.conf

i make the net by a wireless card atmel chip

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.