Difference between revisions of "Troubleshooting Windows shares (samba)"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (Are you using the same workgroup ?)
m (Windows Vista)
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
{{Articles|FAQ|Mediaserver}}
 
{{Articles|FAQ|Mediaserver}}
= Troubleshooting Windows shares (samba) =
+
= Troubleshooting Windows shares ([[samba]]) =
  
 
== On your Windows machines, use DHCP ==
 
== On your Windows machines, use DHCP ==
  
 
This may sound weird, but it solves quite a bit of issues. If you wish to have static addresses, 1 way of doing it is if your router supports static DHCP. This way your PCs/devices will get assigned always the same IP on every dhcp request
 
This may sound weird, but it solves quite a bit of issues. If you wish to have static addresses, 1 way of doing it is if your router supports static DHCP. This way your PCs/devices will get assigned always the same IP on every dhcp request
 +
  
 
== Check your file permissions on the samba share ==
 
== Check your file permissions on the samba share ==
Line 12: Line 13:
  
 
== Windows Vista ==
 
== Windows Vista ==
A samba "bug" has been fixed in samba v3.0.22 <ref>[http://us4.samba.org/samba/docs/ Samba Documentation]</ref><ref> http://www.samba.org/ The samba web site</ref><ref> http://us4.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly)</ref>
+
A samba "bug" has been fixed in samba v3.0.22 <ref>[http://us4.samba.org/samba/docs/ Samba Documentation]</ref><ref> http://www.samba.org/ The samba web site</ref><ref> http://us4.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly)</ref> To connect a password protected samba share from Vista <ref>[http://www.scalefree.info/2006/09/vista_and_buffalo_terastation.html  Vista and Buffalo Terastation]</ref> on a [[w:Buffalo network-attached storage series|Buffalo network-attached storage series]] device using an older version of [[Samba]] (ie Pre v3.0.22), you need to do the following:
 +
# Run the Local Security Policy app - secpol.msc
 +
# Go to Local Policies | Security Options and choose the "Network
 +
# Security: LAN Manager Authentican Level" item
 +
# Set it to "Send LM & NLTM, use NTMLv2 session if negotiated"
 +
 
 +
If for some reason your “secpol.msc” refuses to work, you can manually change a setting in the Windows registery.
 +
 
 +
#  Go in the “Execute command window” and type “regedit” and press “OK”, it will pop the Windows registery window.
 +
#  Browse the this key: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\” and change the value for the option “LMCompatibilityLevel” from value 3 to a value 1.
  
 
== Are you using the same workgroup ? ==
 
== Are you using the same workgroup ? ==
 
Make sure that the '''workgroup''' you use is the same that your windows computers use:
 
Make sure that the '''workgroup''' you use is the same that your windows computers use:
 
*Defined in '''Windows ;ControlPanel:Network:Identification_Tab:Workgroup_field'''
 
*Defined in '''Windows ;ControlPanel:Network:Identification_Tab:Workgroup_field'''
*For a workgroup '''MSHOME''' with a guest account this line should appear in <tt>/etc/smb.conf</tt>  
+
*For a workgroup '''MSHOME''' these lines should appear in <tt>/etc/samba/smb.conf</tt>  
 
  [global]
 
  [global]
  security = share
 
  guest account = smbguest
 
 
   workgroup = MSHOME
 
   workgroup = MSHOME
 +
 +
from webmin:
 +
Windows Networking->Workgroup
  
 
== Try adding guest access ==
 
== Try adding guest access ==
While you may want security w/ user/passwords on your shares, enabling guest access is another way of troubleshooting if you can make it work.<ref>[http://www.troubleshooters.com/linux/samba.htm Troubleshooters.Com and T.C Linux Library Present: Samba]</ref>
+
While you may want security w/ user/passwords on your shares, enabling guest access is another way of troubleshooting if you can make it work. Be aware this will effectively disable security. <ref>[http://www.troubleshooters.com/linux/samba.htm Troubleshooters.Com and T.C Linux Library Present: Samba]</ref>
  
 
1. Pick a directory you wish to share ie: <tt>/mnt/share</tt> and change the access permissions to make it readable and writable to everybody.
 
1. Pick a directory you wish to share ie: <tt>/mnt/share</tt> and change the access permissions to make it readable and writable to everybody.
 
  chmod 777 /mnt/share
 
  chmod 777 /mnt/share
2. Add the <tt>[share]</tt> section to <tt>/etc/samba/smb.conf</tt> This will create a free to all directory.
+
2. Add the <tt>[share]</tt> section to <tt>/etc/samba/smb.conf</tt> This will create a free to all directory, and set the security to share.  Below is a small but complete configuration file you could use.
  
 
'''''/etc/samba/smb.conf'''''
 
'''''/etc/samba/smb.conf'''''
 
<pre>
 
<pre>
 +
[global]
 +
security = share
 +
workgroup = MSHOME
 +
create mode = 777
 +
directory mode = 777
 +
 
[share]
 
[share]
 
  comment = LinkStation Share
 
  comment = LinkStation Share
Line 37: Line 54:
 
  read only = no  
 
  read only = no  
 
  public = yes
 
  public = yes
 +
 
</pre>             
 
</pre>             
 
3. Restart Samba on the Linkstation with this command:
 
3. Restart Samba on the Linkstation with this command:
Line 43: Line 61:
 
5. Doubleclick the icon to see the '''share''' directory.<br>
 
5. Doubleclick the icon to see the '''share''' directory.<br>
 
6. Navigate to the '''share''' directory.<br>
 
6. Navigate to the '''share''' directory.<br>
 +
 +
==Are file names mangled? Try setting the charset==
 +
If you find that files copied to your Samba share work fine when using Samba, but appear with garbled characters when accessed through SSH or SCP (e.g. "menú" shows up as "menú"), the problem is probably the charset you are using. You will need to set the <tt>unix charset</tt> variable in the global section of the <tt>smb.conf</tt> file to the correct value. For example, if you are using Latin1 in Windows, you set:
 +
unix charset = ISO8859-1
  
 
=References=
 
=References=
 
<references/>
 
<references/>

Latest revision as of 04:48, 14 May 2007

Contents

Troubleshooting Windows shares (samba)

On your Windows machines, use DHCP

This may sound weird, but it solves quite a bit of issues. If you wish to have static addresses, 1 way of doing it is if your router supports static DHCP. This way your PCs/devices will get assigned always the same IP on every dhcp request


Check your file permissions on the samba share

Using shell access, go to the directory that's shared, and list its permissions

    • Add discussion about which file perms are recommended and how to change them.

Windows Vista

A samba "bug" has been fixed in samba v3.0.22 [1][2][3] To connect a password protected samba share from Vista [4] on a Buffalo network-attached storage series device using an older version of Samba (ie Pre v3.0.22), you need to do the following:

  1. Run the Local Security Policy app - secpol.msc
  2. Go to Local Policies | Security Options and choose the "Network
  3. Security: LAN Manager Authentican Level" item
  4. Set it to "Send LM & NLTM, use NTMLv2 session if negotiated"

If for some reason your “secpol.msc” refuses to work, you can manually change a setting in the Windows registery.

  1. Go in the “Execute command window” and type “regedit” and press “OK”, it will pop the Windows registery window.
  2. Browse the this key: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\” and change the value for the option “LMCompatibilityLevel” from value 3 to a value 1.

Are you using the same workgroup ?

Make sure that the workgroup you use is the same that your windows computers use:

  • Defined in Windows ;ControlPanel:Network:Identification_Tab:Workgroup_field
  • For a workgroup MSHOME these lines should appear in /etc/samba/smb.conf
[global]
 workgroup = MSHOME

from webmin: Windows Networking->Workgroup

Try adding guest access

While you may want security w/ user/passwords on your shares, enabling guest access is another way of troubleshooting if you can make it work. Be aware this will effectively disable security. [5]

1. Pick a directory you wish to share ie: /mnt/share and change the access permissions to make it readable and writable to everybody.

chmod 777 /mnt/share

2. Add the [share] section to /etc/samba/smb.conf This will create a free to all directory, and set the security to share. Below is a small but complete configuration file you could use.

/etc/samba/smb.conf

[global]
 security = share
 workgroup = MSHOME
 create mode = 777
 directory mode = 777

[share]
 comment = LinkStation Share
 path = /mnt/share
 read only = no 
 public = yes

3. Restart Samba on the Linkstation with this command:

/etc/rc.d/init.d/smb restart

4. In Windows Explorer, doubleclick on Network Neighborhood, then on Entire Network, then on your workgroup (MSHOME in the case), and see if you see your LinkStation
5. Doubleclick the icon to see the share directory.
6. Navigate to the share directory.

Are file names mangled? Try setting the charset

If you find that files copied to your Samba share work fine when using Samba, but appear with garbled characters when accessed through SSH or SCP (e.g. "menú" shows up as "menú"), the problem is probably the charset you are using. You will need to set the unix charset variable in the global section of the smb.conf file to the correct value. For example, if you are using Latin1 in Windows, you set:

unix charset = ISO8859-1

References

  1. Samba Documentation
  2. http://www.samba.org/ The samba web site
  3. http://us4.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly)
  4. Vista and Buffalo Terastation
  5. Troubleshooters.Com and T.C Linux Library Present: Samba