特殊:Badtitle/NS100:SettingUpSamba:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:SettingUpSamba}} | {{Languages|UbuntuHelp:SettingUpSamba}} | ||
#title Setting Up Samba | #title Setting Up Samba | ||
<<Include(Tag/StyleCleanup)>> | |||
<<Include(Tag/ContentCleanup)>> | |||
<<Include(Tag/TooLong)>> | |||
Please note: This article contains information that may be outdated and may be different for more recent Ubuntu releases. | |||
<<Anchor(Top)>> | <<Anchor(Top)>> | ||
== What is Samba and when do you need it? == | == What is Samba and when do you need it? == | ||
第15行: | 第19行: | ||
* Access shared folders, drives and printers on a Windows computer (that is, act as a client with Windows servers). To do this, you only need the '''smbfs''' plugin. See [[UbuntuHelp:MountWindowsSharesPermanently|MountWindowsSharesPermanently]] for more information. | * Access shared folders, drives and printers on a Windows computer (that is, act as a client with Windows servers). To do this, you only need the '''smbfs''' plugin. See [[UbuntuHelp:MountWindowsSharesPermanently|MountWindowsSharesPermanently]] for more information. | ||
* Have your Windows computer use (via a network) a printer that is attached to a Linux computer. CUPS can be configured to make the printer accessible to the network. | * Have your Windows computer use (via a network) a printer that is attached to a Linux computer. CUPS can be configured to make the printer accessible to the network. | ||
* Share directories between two Linux computers. You can use NFS or setup an SSH server on one computer and access it from other computers using an scp or sftp client, or Places > Connect to... | * Share directories between two Linux computers. You can use NFS or setup an [[UbuntuHelp:SSH|SSH]] server on one computer and access it from other computers using an scp or sftp client, or Places -> Connect to Server... and choose "SSH" as the service type. | ||
=== Nautilus Integration === | |||
If you want to be able to share folders with nautilus (the file browser), install the nautilus-share package: | |||
<pre><nowiki> | |||
sudo apt-get install nautilus-share | |||
</nowiki></pre> | |||
=== Server === | === Server === | ||
If you wish your computer to act as a Samba server (act as a file or printer server) then install the <code><nowiki>samba</nowiki></code> package (see [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for details): | If you wish your computer to act as a Samba server (act as a file or printer server) then install the <code><nowiki>samba</nowiki></code> package (see [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for details): | ||
第33行: | 第42行: | ||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
== Server Configuration == | == Server Configuration == | ||
For Ubuntu 8.04 (Hardy) and later, shared folders are created directly from the folder. Browse to the location of the folder you would like to share, right-click the folder, and choose '''Sharing Options'''. Click the '''Share this folder''' check box, and click '''Install Services'''. Enter your password, and the Samba server packages will be downloaded and installed. | For Ubuntu 8.04 (Hardy) and later, shared folders are created directly from the folder. Browse to the location of the folder you would like to share, right-click the folder, and choose '''Sharing Options'''. Click the '''Share this folder''' check box, and click '''Install Services'''. Enter your password, and the Samba server packages will be downloaded and installed. | ||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
== Browsing SMB shares == | == Browsing SMB shares == | ||
第70行: | 第56行: | ||
However, remember that this is less secure. | However, remember that this is less secure. | ||
Be warned you are installing a service (server) and you may wish to install a | Be warned you are installing a service (server) and you may wish to install a [[UbuntuHelp:Firewall|Firewall]] management utility to help prevent undesired access. See also the manual configuration sections below to learn how to "hide" your shares from browsing and set a password for access. | ||
=== Ubuntu Server === | === Ubuntu Server === | ||
This section enables Ubuntu as a samba file server. | This section enables Ubuntu as a samba file server. | ||
第80行: | 第66行: | ||
sudo apt-get update | sudo apt-get update | ||
</nowiki></pre> | </nowiki></pre> | ||
Try again and Ubuntu will download and install samba. Right click on the "Documents" directory and in the pop up menu select "Share Folder". You will get a pop up menu "Share Folder". Select "Windows networks (SMB)" in the pull down menu and give your share a name in the "Name" box. Unselect the "Read only" check box if you want read/write access to the share. Click the "Share" button. | |||
=== Windows XP Server === | === Windows XP Server === | ||
This section enables Windows XP as a samba file server. | This section enables Windows XP as a samba file server. | ||
第216行: | 第202行: | ||
sudo mount /media/samba_share | sudo mount /media/samba_share | ||
</nowiki></pre> | </nowiki></pre> | ||
CIFS may cause a shutdown error. | |||
<pre><nowiki> | |||
CIFS VFS: Server not responding. | |||
</nowiki></pre> | |||
There is a [http://ubuntuforums.org/showthread.php?t=288534 fix in the troubleshooting section of this forum post.] | |||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
==== SMBFS ==== | ==== SMBFS ==== | ||
第256行: | 第247行: | ||
...it should contain two lines as follows: | ...it should contain two lines as follows: | ||
<pre><nowiki> | <pre><nowiki> | ||
username = george | username=george | ||
password = secret | password=secret | ||
</nowiki></pre> | </nowiki></pre> | ||
Change the permissions on the file for security: | Change the permissions on the file for security: | ||
第349行: | 第340行: | ||
If you have more than one network card (or interface) then you have to define where you want Samba to run. In smb.conf under the [global] section, add: | If you have more than one network card (or interface) then you have to define where you want Samba to run. In smb.conf under the [global] section, add: | ||
<pre><nowiki> | <pre><nowiki> | ||
interfaces = 127.0.0.1, 192.168.0.31/24 | |||
bind interfaces only = yes | |||
</nowiki></pre> | </nowiki></pre> | ||
The first address (127.0.0.1), is a loopback network connection (it's your own machine). | The first address (127.0.0.1), is a loopback network connection (it's your own machine). | ||
第357行: | 第348行: | ||
You can limit which IP address can connect to your Samba server adding these lines: | You can limit which IP address can connect to your Samba server adding these lines: | ||
<pre><nowiki> | <pre><nowiki> | ||
hosts allow = 127.0.0.1, 192.168.0.31, 192.168.0.32 | |||
hosts deny = 0.0.0.0/0 | |||
</nowiki></pre> | </nowiki></pre> | ||
The loopback address must be present in the first line. The second line deny access from all IP address not in the first line. | The loopback address must be present in the first line. The second line deny access from all IP address not in the first line. | ||
第404行: | 第395行: | ||
=== Graphical Configuration === | === Graphical Configuration === | ||
==== Setup Ubuntu Print Server ==== | ==== Setup Ubuntu Print Server ==== | ||
<ol><li>In your menu go to System -> Administration -> Printing | |||
</li><li>Under "Local Printers" on the left, select the printer you wish to share. Select the "Policies" tab on the right and make sure the "Shared" box is selected.</li></ol> | |||
===== Ubuntu Client ===== | ===== Ubuntu Client ===== | ||
<ol><li>Again go to System -> Administration -> Printing | |||
</li><li>Click "New Printer" in the upper right. In the next menu select "Windows Printer via SAMBA". Now enter your Ubuntu Samba Print Server (set up as above) IP address in the box on the left titled "smb://". Click the "Browse" button. | |||
</li><li>Select the printer in the "SMB Browser" window (Click on the little arrows). Once you have selected your printer, check the "Authentication required" and enter your samba user name and password. Then click the "Verify" button. You should see confirmation that the share is available. | |||
</li><li>Click the "Forward" button and install the drivers for your printer as you would for any other printer.</li></ol> | |||
===== Windows Client ===== | ===== Windows Client ===== | ||
<ol><li>Go to Control Panel -> Printers | |||
</li><li>Click "Add a printer" on the upper left. The printer wizard will start -> click forward. Select Network Printer and click "Next". Select "Browse for a printer" (Top button) and click "Next". In the next window, navigate to your Ubuntu Samba Print Server and click "Next". Continue with the printer and driver installation.</li></ol> | |||
For more information, see [[UbuntuHelp:NetworkPrintingFromWinXP|NetworkPrintingFromWinXP]]. | For more information, see [[UbuntuHelp:NetworkPrintingFromWinXP|NetworkPrintingFromWinXP]]. | ||
第466行: | 第457行: | ||
This section was started to give some general advise on security considerations and is not an exhaustive review of samba security. | This section was started to give some general advise on security considerations and is not an exhaustive review of samba security. | ||
=== /etc/samba/smb.conf === | === /etc/samba/smb.conf === | ||
* Networking Section - use "hosts allow" and "hosts deny" | |||
<pre><nowiki> | <pre><nowiki> | ||
# hosts allow = 127.0.0.1 192.168.1.0/24 | # hosts allow = 127.0.0.1 192.168.1.0/24 | ||
第474行: | 第464行: | ||
</nowiki></pre> | </nowiki></pre> | ||
hosts deny 0.0.0.0/0 = all others. | hosts deny 0.0.0.0/0 = all others. | ||
* Shares | |||
* When defining a share, consider the following options : | |||
When defining a share, consider the following options : | |||
<ol><li>browseable = no ~ Shares will not show up when browsing your network. | <ol><li>browseable = no ~ Shares will not show up when browsing your network. | ||
</li><li>users = user1 user2 ~ List of users able to access the share</li></ol> | </li><li>users = user1 user2 ~ List of users able to access the share</li></ol> | ||
第502行: | 第491行: | ||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
== Tips / Permissions == | == Tips / Permissions == | ||
Samba permissions are sometimes a little | Samba permissions are sometimes a little tricky. | ||
=== Server side === | === Server side === | ||
<ol><li>The name of your samba share is the word on the [ ]</li></ol> | |||
[private] = share name of "private". | [private] = share name of "private". | ||
[secret] = share name of "secret". | [secret] = share name of "secret". | ||
<ol><li>To be able to mount the samba share, samba users on the server must have permission to access the directory.</li></ol> | |||
If <code><nowiki>/path/to/share/point</nowiki></code> in "path = /path/to/share/point" is owned by root.root with permissions of 770 , only root will be able to mount the share. | If <code><nowiki>/path/to/share/point</nowiki></code> in "path = /path/to/share/point" is owned by root.root with permissions of 770 , only root will be able to mount the share. | ||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
=== Client side === | === Client side === | ||
<ol><li>If you do not user a credentials file, do not forget to specify your samba_user at the time of mounting ( -o username=samba_user ). | |||
</li><li>Permissions on a samba share depend on the ''Server''.</li></ol> | |||
'''Linux servers''' will honor full Linux permissions. | '''Linux servers''' will honor full Linux permissions. | ||
第528行: | 第517行: | ||
</nowiki></pre> | </nowiki></pre> | ||
These options will be used for all files and directories on the (Windows) samba share and can not be changed. | These options will be used for all files and directories on the (Windows) samba share and can not be changed. | ||
<ol><li>Permissions of new files on the samba share are set by your umask. | |||
</li><li>To mount your samba shares via (server) hostname rather than IP Address, add an entry for your server in /etc/hosts (C:\WINDOWS\system32\drivers\etc\hosts for Windows).</li></ol> | |||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
== Links == | == Links == | ||
* [[UbuntuHelp:SettingUpSambaPDC|SettingUpSambaPDC]] | * [[UbuntuHelp:SettingUpSambaPDC|SettingUpSambaPDC]] | ||
* http://www. | * [[UbuntuHelp:ActiveDirectoryHowto|ActiveDirectoryHowto]] | ||
* http://www.samba.org/ The Samba web site | |||
* http://us1.samba.org/samba/docs/man/Samba-HOWTO-Collection/ 900+ pg pdf document, seems to be updated daily | * http://us1.samba.org/samba/docs/man/Samba-HOWTO-Collection/ 900+ pg pdf document, seems to be updated daily | ||
* http://us1.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly) | * http://us1.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly) | ||
* http://ubuntuguide.org/wiki/Ubuntu:Jaunty#Samba_File_Sharing | |||
* http://ubuntuguide.org/wiki/ | |||
* http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch12_:_Samba_Security_and_Troubleshooting "Samba Troubleshooting on linuxhomenetworking.com" | * http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch12_:_Samba_Security_and_Troubleshooting "Samba Troubleshooting on linuxhomenetworking.com" | ||
[[UbuntuHelp:[Top|Back to top]]] | [[UbuntuHelp:[Top|Back to top]]] | ||
---- | ---- | ||
[[category: | [[category:CategoryNetworking]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2009年11月17日 (二) 20:36的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/SettingUpSamba }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/af | • {{#if: UbuntuHelp:SettingUpSamba|Afrikaans| [[::SettingUpSamba/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ar | • {{#if: UbuntuHelp:SettingUpSamba|العربية| [[::SettingUpSamba/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/az | • {{#if: UbuntuHelp:SettingUpSamba|azərbaycanca| [[::SettingUpSamba/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/bcc | • {{#if: UbuntuHelp:SettingUpSamba|جهلسری بلوچی| [[::SettingUpSamba/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/bg | • {{#if: UbuntuHelp:SettingUpSamba|български| [[::SettingUpSamba/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/br | • {{#if: UbuntuHelp:SettingUpSamba|brezhoneg| [[::SettingUpSamba/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ca | • {{#if: UbuntuHelp:SettingUpSamba|català| [[::SettingUpSamba/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/cs | • {{#if: UbuntuHelp:SettingUpSamba|čeština| [[::SettingUpSamba/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/de | • {{#if: UbuntuHelp:SettingUpSamba|Deutsch| [[::SettingUpSamba/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/el | • {{#if: UbuntuHelp:SettingUpSamba|Ελληνικά| [[::SettingUpSamba/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/es | • {{#if: UbuntuHelp:SettingUpSamba|español| [[::SettingUpSamba/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/fa | • {{#if: UbuntuHelp:SettingUpSamba|فارسی| [[::SettingUpSamba/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/fi | • {{#if: UbuntuHelp:SettingUpSamba|suomi| [[::SettingUpSamba/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/fr | • {{#if: UbuntuHelp:SettingUpSamba|français| [[::SettingUpSamba/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/gu | • {{#if: UbuntuHelp:SettingUpSamba|ગુજરાતી| [[::SettingUpSamba/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/he | • {{#if: UbuntuHelp:SettingUpSamba|עברית| [[::SettingUpSamba/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/hu | • {{#if: UbuntuHelp:SettingUpSamba|magyar| [[::SettingUpSamba/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/id | • {{#if: UbuntuHelp:SettingUpSamba|Bahasa Indonesia| [[::SettingUpSamba/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/it | • {{#if: UbuntuHelp:SettingUpSamba|italiano| [[::SettingUpSamba/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ja | • {{#if: UbuntuHelp:SettingUpSamba|日本語| [[::SettingUpSamba/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ko | • {{#if: UbuntuHelp:SettingUpSamba|한국어| [[::SettingUpSamba/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ksh | • {{#if: UbuntuHelp:SettingUpSamba|Ripoarisch| [[::SettingUpSamba/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/mr | • {{#if: UbuntuHelp:SettingUpSamba|मराठी| [[::SettingUpSamba/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ms | • {{#if: UbuntuHelp:SettingUpSamba|Bahasa Melayu| [[::SettingUpSamba/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/nl | • {{#if: UbuntuHelp:SettingUpSamba|Nederlands| [[::SettingUpSamba/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/no | • {{#if: UbuntuHelp:SettingUpSamba|norsk| [[::SettingUpSamba/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/oc | • {{#if: UbuntuHelp:SettingUpSamba|occitan| [[::SettingUpSamba/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/pl | • {{#if: UbuntuHelp:SettingUpSamba|polski| [[::SettingUpSamba/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/pt | • {{#if: UbuntuHelp:SettingUpSamba|português| [[::SettingUpSamba/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ro | • {{#if: UbuntuHelp:SettingUpSamba|română| [[::SettingUpSamba/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/ru | • {{#if: UbuntuHelp:SettingUpSamba|русский| [[::SettingUpSamba/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/si | • {{#if: UbuntuHelp:SettingUpSamba|සිංහල| [[::SettingUpSamba/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/sq | • {{#if: UbuntuHelp:SettingUpSamba|shqip| [[::SettingUpSamba/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/sr | • {{#if: UbuntuHelp:SettingUpSamba|српски / srpski| [[::SettingUpSamba/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/sv | • {{#if: UbuntuHelp:SettingUpSamba|svenska| [[::SettingUpSamba/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/th | • {{#if: UbuntuHelp:SettingUpSamba|ไทย| [[::SettingUpSamba/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/tr | • {{#if: UbuntuHelp:SettingUpSamba|Türkçe| [[::SettingUpSamba/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/vi | • {{#if: UbuntuHelp:SettingUpSamba|Tiếng Việt| [[::SettingUpSamba/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/yue | • {{#if: UbuntuHelp:SettingUpSamba|粵語| [[::SettingUpSamba/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/zh | • {{#if: UbuntuHelp:SettingUpSamba|中文| [[::SettingUpSamba/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/zh-hans | • {{#if: UbuntuHelp:SettingUpSamba|中文(简体)| [[::SettingUpSamba/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SettingUpSamba | UbuntuHelp:SettingUpSamba | {{#if: | :}}SettingUpSamba}}/zh-hant | • {{#if: UbuntuHelp:SettingUpSamba|中文(繁體)| [[::SettingUpSamba/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:SettingUpSamba|:SettingUpSamba|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :SettingUpSamba/zh | | {{#ifexist: SettingUpSamba/zh | | {{#ifeq: {{#titleparts:SettingUpSamba|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:SettingUpSamba|1|-1|}} | zh | | }}
- title Setting Up Samba
<<Include(Tag/StyleCleanup)>> <<Include(Tag/ContentCleanup)>> <<Include(Tag/TooLong)>> Please note: This article contains information that may be outdated and may be different for more recent Ubuntu releases. <<Anchor(Top)>>
What is Samba and when do you need it?
To make a long story short: The Samba project was started in 1992 by Andrew Tridgell. Samba is a set of tools to share files and printers with computers running Microsoft Windows. It implements the SMB network protocol, which is the heart of Windows networking. Samba can be used to:
- Act as a server for Windows (or Samba) clients: share folders and printers, including PDF pseudo-printers so all the computers in your network may write PDF files
- Act as a domain controller in a Windows network (authenticating users, etc.)
- Do some more complex things, such as using a Windows domain controller to authenticate the users of a Linux/UNIX machine
Samba is freely available under the GNU General Public License. More information about Samba can be found at http://www.samba.org. [[UbuntuHelp:[Top|Back to top]]]
What to install
The samba
package is a meta-package intended to be installed on servers. Clients do not need this meta-package. It is not necessary for clients to do any of the following:
- Access shared folders, drives and printers on a Windows computer (that is, act as a client with Windows servers). To do this, you only need the smbfs plugin. See MountWindowsSharesPermanently for more information.
- Have your Windows computer use (via a network) a printer that is attached to a Linux computer. CUPS can be configured to make the printer accessible to the network.
- Share directories between two Linux computers. You can use NFS or setup an SSH server on one computer and access it from other computers using an scp or sftp client, or Places -> Connect to Server... and choose "SSH" as the service type.
Nautilus Integration
If you want to be able to share folders with nautilus (the file browser), install the nautilus-share package:
sudo apt-get install nautilus-share
Server
If you wish your computer to act as a Samba server (act as a file or printer server) then install the samba
package (see InstallingSoftware for details):
sudo aptitude install samba
Client
The samba
package is not needed on clients. Install smbfs
instead (see InstallingSoftware for details):
sudo aptitude install smbfs
If you want to connect to a Samba server (Windows server or an Ubuntu server running Samba) you have two options, you can use the smbclient command or you can directly mount the samba file system via smbfs
.
Command line
Ubuntu will connect to a Samba server out of the box via smbclient. This is a similar to a FTP connection. Once connected, you can use commands such as ls, cd , put, and get.
smbfs
This package allows clients to mount Samba file shares, allowing them to act as local disks. Most people will prefer this method. [[UbuntuHelp:[Top|Back to top]]]
Server Configuration
For Ubuntu 8.04 (Hardy) and later, shared folders are created directly from the folder. Browse to the location of the folder you would like to share, right-click the folder, and choose Sharing Options. Click the Share this folder check box, and click Install Services. Enter your password, and the Samba server packages will be downloaded and installed. [[UbuntuHelp:[Top|Back to top]]]
Ubuntu and Gnome make it easy to access files on a Windows network share. Open the Places Menu, then click on Network. You will see a Windows network icon. Double-click to open it. The next window shows all the domains/workgroups found on your network. Inside each domain/workgroup you will see all the computers on the domain/workgroup with sharing enabled. Double-click on a computer icon to access its shares and files. Before showing a computer's shares, your system may prompt you for a name and password. Fill in the form with the credentials of a valid user for the computer you are connecting to. You may additionally store that password in your keyring for convenience. Note: The default installation of Samba does not synchronize passwords. You may have to run "smbpasswd" for each user that needs to have access to his Ubuntu home directory from Microsoft Windows. [[UbuntuHelp:[Top|Back to top]]]
Graphical Configuration
This section is for those preferring to use graphical tools. This section should allow you to "quick start" SMB shares between Ubuntu and either Ubuntu or Windows servers. The gui method is easier to work with, because:
- Shares are Public (browsable in Network Places)
- A password is not set for shares (they can be mounted by anyone).
However, remember that this is less secure. Be warned you are installing a service (server) and you may wish to install a Firewall management utility to help prevent undesired access. See also the manual configuration sections below to learn how to "hide" your shares from browsing and set a password for access.
Ubuntu Server
This section enables Ubuntu as a samba file server.
Sharing a Folder
To share a directory you must have permission to access the directory. Go to your home directory ( Places -> Home folder). Right click on the "Documents" directory and in the pop up menu select "Share Folder". If samba is not installed you will get a pop up menu "Sharing services are not installed". Select "Install Windows networks support (SMB)" and deselect "Install Unix networks support (NFS)" -> then click "Install services". If you get an error message that the samba .deb could not be found, open a terminal and update apt-get.
sudo apt-get update
Try again and Ubuntu will download and install samba. Right click on the "Documents" directory and in the pop up menu select "Share Folder". You will get a pop up menu "Share Folder". Select "Windows networks (SMB)" in the pull down menu and give your share a name in the "Name" box. Unselect the "Read only" check box if you want read/write access to the share. Click the "Share" button.
Windows XP Server
This section enables Windows XP as a samba file server.
Sharing a Folder
1. On the Windows server, browse in explorer ("My Computer") to the location of the folder you wish to share (C:\Documents and Settings for example). Next right click on the folder to share and select "Sharing and Security...". In the pop-up dialog box click the "Sharing" tab. Click the "Network Setup Wizard" to configure your network to allow shares. Work your way through the wizard. Note the default workgroup is MSHOME. You may change this value if you like but all your computers should be in the same workgroup. Eventually you will be given the option to "Turn on file and printer sharing". This is the option you want, continue with the network wizard. You will have to restart your computer for the settings to take effect -> Restart Windows. 2. After rebooting, again open explorer ("My Computer") and navigate to the folder you wish to share. Again right click on the folder and select "Sharing and Security...". In the pop-up dialog box click the "Sharing" tab. In the "Network sharing and security" box, tic (select with the mouse) the "Share this folder on the network" box. Give the folder a share name. This will give read only access to Ubuntu computers via samba. To allow read/write access tic (select with the mouse) the "Allow network users to change my files" box. Click the "Apply" button and close the dialog box.
Connect to a samba server
Configure your Ubuntu or Windows XP samba server as above.
Ubuntu Client
On the Ubuntu client using the menu at the top, go to "Places" -> "Network". You will see an icon "Windows network" and should be able to browse to your shared folder. You will be asked for a password, leave it blank. Click the "Connect button. Alternate : From the menu at the top select "Location" -> "Connect to a server". In the "Service type" pull down select "Windows share". Enter the server ip address in the "Server:" box and the share name in the "Share:" box. Click "Connect" and then "Connect" again on the second dialog box (no need for a password). If you would like to mount your SMB share using your (server) hostname rather than the IP Address, edit /etc/hosts and add your samba server (syntax IP Address hostname).
192.168.1.100 hostname
Where "hostname" = the name of your samba server.
Windows XP Client
On Windows open "My Computer" and navigate to "My Network Places". Navigate to your Ubuntu server and your share will be available without a password. Alternate : From the menu at the top select "Tools" -> "Map Network Drive". Select an available letter for your SMB share (Default is z: ). In the "Folder:" box enter \\samba_server_ipaddress\share. Tic (Select with the mouse) the option "Reconnect at login" if you want the share to be automatically mounted when you boot Windows. Click the "Finish" box. A dialog box will appear, enter your samba user name and password. Click "OK". If you would like to mount your SMB share using your (server) hostname rather than the IP Address, edit C:\WINDOWS\system32\drivers\etc\hosts and add your samba server (syntax IP Address hostname).
192.168.1.100 hostname
Where "hostname" = the name of your samba server. [[UbuntuHelp:[Top|Back to top]]]
Samba Client Manual Configuration
This section covers how to manually configure and connect to a SMB file server from an Ubuntu client. smbclient
is a command line tool similar to a ftp connection while smbfs
allows you to mount a SMB file share. Once a SMB share is mounted it acts similar to a local hard drive (you can access the SMB share with your file browser (nautilus, konqueror, thunar, other).
Connecting to a Samba File Server
Command line
Connecting from the command line is similar to a ftp connection. List public SMB shares with
smbclient -L //server -U user
Connect to a SMB share with
smbclient //server/share -U user
Enter you user password. You can connect directly with
smbclient //server/share -U user%password
but your password will show on the screen (less secure). Once connected you will get a prompt that looks like this :
smb: \>
Type "help" , without quotes, at the prompt for a list of available commands. [[UbuntuHelp:[Top|Back to top]]]
CIFS
CIFS is included in the smbfs package and is a replacement for smbfs (I know, the terminology here is a little confusing).
Reference : http://linux-cifs.samba.org/
As above, install by any method, smbfs
.
By default only root may mount SMB shares on the command line. To allow non-root users to mount SMB shares you could set the SUID, but I advise you configure sudo. You should configure sudo with visudo You may either allow the gruop "users" to mount SMB shares, or add a group, samba, and add users you wish to allow to mount SMB shares to the samba group.
sudo groupadd samba sudo adduser user samba
Change "user" to the username you wish to add to the samba group.
sudo visudo
In the "group" section add your group you wish to allow to mount SMB shares
Add a line in the "group" section : %admin ALL=(ALL) ALL %samba ALL=(ALL) /bin/mount,/bin/umount,/sbin/mount.cifs,/sbin/umount.cifs
Change "%samba" to "%users" if you wish to allow members of the users group to mount SMB shares.
The following will mount the myshare folder on myserver to ~/mnt
(it will be in your home directory):
mkdir ~/mnt sudo mount -t cifs //myserver_ip_address/myshare ~/mnt -o username=samb_user,noexec
Note: "samba_user" = the user name on the samba server (may be different from your log-in name on the client). The "noexec" option prevents executable scripts running from the SMB share. You will be asked for BOTH your sudo and then your samba_user password. To umount,
sudo umount ~/mnt
In order to have a share mounted automatically every time you reboot, you need to do the following: With any editor, create a file containing your Windows/Samba user account details:
gksu gedit /etc/samba/user
KDE users must use kdesu rather than gksu and instead of Gedit they can use Kwrite as editor. ... it should contain two lines as follows:
username=samba_user password=samba_user_password
Note: "samba_user" = the user name on the samba server (may be different from your log-in name on the client). "samba_user_password" is the password you assigned to the samba_user on the samba server. Save the file and exit gedit. Change the permissions on the file for security:
sudo chmod 0400 /etc/samba/user # permissions of 0400 = read only
Now create a directory where you want to mount your share (e.g. /media/samba_share):
sudo mkdir /media/samba_share
Now, using any editor, and add a line to /etc/fstab for your SMB share as follows:
sudo cp /etc/fstab /etc/fstab.bak gksu gedit /etc/fstab
Add a line for your SMB share:
//myserver_ip_address/myshare /media/samba_share cifs credentials=/etc/samba/user,noexec 0 0
The share will mount automatically when you boot. The "noexec" option prevents executable scripts running from the SMB share. To mount the share now, without rebooting,
sudo mount /media/samba_share
You can unmount the share with :
sudo umount /media/samba_share
If you wish to increase security at the expense of convenience, use this line in /etc/fstab
//myserver_ip_address/myshare /media/samba_share cifs noauto,credentials=/etc/samba/user,noexec 0 0
The noexec" option prevents executable scripts running from the SMB share.
Edit /etc/samba/user
, remove the password (leave just the samba user).
Now the share will NOT automatically mount when you boot and you will be asked for your samba password.
Mount the share with :
sudo mount /media/samba_share
CIFS may cause a shutdown error.
CIFS VFS: Server not responding.
There is a fix in the troubleshooting section of this forum post. [[UbuntuHelp:[Top|Back to top]]]
SMBFS
Note: This method still works, but as outlined under the "CIFS" section above is "deprecated" (no longer maintained and pending removal from the kernel). Mounting a share on the local filesystem allows you to work around programs that do not yet use GnomeVFS to browse remote shares transparently. To mount a SMB share, first install smbfs:
sudo apt-get update sudo apt-get install smbfs
To allow non root accounts to mount shares, change the permissions on the smbmnt program thus:
sudo chmod u+s /usr/bin/smbmnt /usr/bin/smbumount
Note: This may be a security risk as after setting the SUID bit anyone can mount a SMB share. I advise you configure sudo, as above. The working line in /etc/sudoers is as follows (see CIFS section above):
%samba ALL=(ALL) /bin/mount,/bin/umount,/sbin/mount.cifs,/sbin/umount.cifs,/usr/bin/smbmount,/usr/bin/smbumount
This allows any user in the samba group to mount SMB shares (you will need to create a samba group and add users).
The following will mount the myshare folder on myserver to ~/mnt
(it will be in your home directory):
mkdir ~/mnt smbmount //myserver/myshare ~/mnt
To umount,
smbumount ~/mnt
In order to have a share mounted automatically every time you reboot, you need to do the following: Open a shell as root
sudo -s
Create a file containing your Windows/Samba user account details:
vi /etc/samba/user
...it should contain two lines as follows:
username=george password=secret
Change the permissions on the file for security:
chmod 0600 /etc/samba/user
Now create a directory where you want to mount your share (e.g. /mnt/data):
mkdir /mnt/data
Now edit the file system table (/etc/fstab) and add a line as follows:
//server/share /mnt/data smbfs credentials=/etc/samba/user,rw,uid=bob 0 0
...where 'bob' is the non-root user you log into ubuntu with, 'server' is the name or address of the Windows machine and 'share' is the name of the share. To mount the share now, just use the following command as root. It will mount automatically on subsequent reboots.
mount /mnt/data
to be continued... [[UbuntuHelp:[Top|Back to top]]]
Samba Server Manual Configuration
Configuration is performed by reading and editing /etc/samba/smb.conf, the configuration file for the samba server. There are a few graphical tools available such as "kdenetwork-filesharing" and "Swat". A fairly comprehensive graphical Samba configuration tool is available for KDE, by installing the "kdenetwork-filesharing" package. Once install, you can find it by launching the KDE Control Center. (Alt-F2 and then type kcontrol). Browse to Internet & Network > Samba. It is fairly easy to use. A less friendly but also graphical tool is Swat, a web-based interface. The following tips show how to do some basic things without installing additional software, using the command line. It is not difficult, just be careful with typos. First open a terminal: Applications > System Tools > Terminal and open the file smb.conf
sudo nano -w /etc/samba/smb.conf
How to Save: To save in nano use "CTRL-O", then "CTRL-X". Tip: Replacing nano with gedit gives you a nice graphical editor. The file *smb.conf* is divided in several sections:
Global Settings Debugging/Accounting Authentication Printing File sharing Misc Share Definitions
Comments may start with either a # or a ;
Global Settings
Let's start with Global Settings. Here you will see several lines, which you can also see in the graphical networktool like workgroup and wins server. If you changed everything to your liking already then you can skip this section, if not change to what you need. If you do not know what items mean, leave them be and read the relevant part in the real Samba-howto instead of randomly changing them. It will save you trouble-shooting later.
File Sharing (Basics)
The important part for us is File sharing. Samba shares are named in brackets, [ ], and configured by adding options in the lines that follow. Most options are boolean (yes / no). We need to change:
[homes] comment = Home Directories browseable = no # By default, the home directories are exported read-only. Change next # parameter to 'yes' if you want to be able to write to them. writable = no
This describes your /home folder. Usually you want to share this folder in a home-environment, because these are the files you want to share. To do so, make the following changes:
[homes] comment = Home Directories browseable = yes # By default, the home directories are exported read-only. Change next # parameter to 'yes' if you want to be able to write to them. writable = yes
This finishes sharing your /home folder. The last thing we need to do is fixing a user. Add users who can access your shares with the 'smbpasswd' command.
sudo smbpasswd -a username New SMB password: Retype new SMB password: Added user username.
NOTE: the username used here should be a real user setup on your PC/Server. Reload Samba for every change to users/passwords or 'smb.conf'
sudo /etc/init.d/samba reload
That's the basis of Samba file-sharing. Please leave your comments about what else is needed here. - Can/should the SMB password be different from the user's system password? MartinSpacek - 2007-11-19 [[UbuntuHelp:[Top|Back to top]]]
File Sharing (Advanced)
We started with the base of Samba file-sharing. The above-mentioned items should be enough to get you started. Next we will add details that you might or might not need.
If you have more than one network card
If you have more than one network card (or interface) then you have to define where you want Samba to run. In smb.conf under the [global] section, add:
interfaces = 127.0.0.1, 192.168.0.31/24 bind interfaces only = yes
The first address (127.0.0.1), is a loopback network connection (it's your own machine). The second address (192.168.0.31), is the address of the card you want Samba to run on, the second number (24) is the subnet default for a CLASS-C network. It may vary depending on your network. With "bind interfaces only" you limit which interfaces on a machine will serve SMB requests. You can limit which IP address can connect to your Samba server adding these lines:
hosts allow = 127.0.0.1, 192.168.0.31, 192.168.0.32 hosts deny = 0.0.0.0/0
The loopback address must be present in the first line. The second line deny access from all IP address not in the first line. [[UbuntuHelp:[Top|Back to top]]]
First you'll want to set this up in the [global] section of your smb.conf
[global] security = user encrypt passwords = true map to guest = bad user guest account = nobody
security = user
restricts logins to users on your server. encrypt passwords = true
is necessary for most modern versions of Windows to login to your shares. map to guest = bad user
will map login attempts with bad user names to the guest account you specify with guest account = nobody
. That is, if you attempt to login to the share with a user name not set up with smbpasswd
the you will be logged in as the user nobody.
Next the private share
[private] comment = Private Share path = /path/to/share/point browseable = no read only = no
If browsable is set to no the share will not show up on graphical browsers such a "My Network Places" on Windows or Places -> Network on Ubuntu.
path
is the path to the directory that you want to share out. browseable = no
will have the share not show up when users browse the network. read only = no
will let you, as an authenticated user, write to the share.
Finally, the public share
[public] comment = Public Share path = /path/to/share/point read only = no guest only = yes guest ok = yes
Again, path
is the path to the directory that you want to share out. read only = no
will allow users to write to this share. guest only = yes
and guest ok = yes
will allow guest logins and also force users to login as guests. The user you specified with guest account
in the [global] section must have write permissions on /path/to/share/point
in order to write files to the share.
Note: When Windows attempts to access a SMB share it will use the current Windows user name and password. The map to guest = bad user
trick above allows access to the public share only if you give Samba an incorrect user name. If you give it a valid user name, but a bad password, the login will fail and Windows will give you a password prompt when you try to access the share. If you have the same user name for your Windows machine and your Ubuntu machine, you could be unwittingly giving the Samba server a valid user name, but invalid password. To resolve this you will either have to change the Windows user name, or to remove that user name from the Samba password file with sudo smbpasswd -x [username]
.
Note: The above uses security = user
. To access the private shares you will have to make sure the user exists in smbpasswd. These users must also already exist as normal users on your machine. You add users to smbpasswd simply by running sudo smbpasswd -a [username]
and giving a password.
Setting permissions
To set permissions of newly created documents / files edit /etc/samba/smb.conf and in the [global] section add :
create mask = 0644 directory mask = 0755
[[UbuntuHelp:[Top|Back to top]]]
Sharing CUPS Printers
Graphical Configuration
Setup Ubuntu Print Server
- In your menu go to System -> Administration -> Printing
- Under "Local Printers" on the left, select the printer you wish to share. Select the "Policies" tab on the right and make sure the "Shared" box is selected.
Ubuntu Client
- Again go to System -> Administration -> Printing
- Click "New Printer" in the upper right. In the next menu select "Windows Printer via SAMBA". Now enter your Ubuntu Samba Print Server (set up as above) IP address in the box on the left titled "smb://". Click the "Browse" button.
- Select the printer in the "SMB Browser" window (Click on the little arrows). Once you have selected your printer, check the "Authentication required" and enter your samba user name and password. Then click the "Verify" button. You should see confirmation that the share is available.
- Click the "Forward" button and install the drivers for your printer as you would for any other printer.
Windows Client
- Go to Control Panel -> Printers
- Click "Add a printer" on the upper left. The printer wizard will start -> click forward. Select Network Printer and click "Next". Select "Browse for a printer" (Top button) and click "Next". In the next window, navigate to your Ubuntu Samba Print Server and click "Next". Continue with the printer and driver installation.
For more information, see NetworkPrintingFromWinXP. [[UbuntuHelp:[Top|Back to top]]]
Manual Server Configuration
If You would like to share Your printers make the following changes to Samba: If not already done create the Samba-user You want the share to be used by. In smb.conf uncomment and change the lines ending up with the following configuration:
# If you want to automatically load your printer list rather # than setting them up individually then you'll need this load printers = yes # [...] // Some BSD printing stuff, do not edit if You do not need to # CUPS printing. See also the cupsaddsmb(8) manpage in the # cupsys-client package. printing = cups printcap name = cups
and in the Share Definitions section append and/or modify the [printers] part ending up like this:
# ======================= Share Definitions ======================= # [...] // File and Folder sharing, do not edit if You do not need to [printers] comment = All Printers browseable = no path = /tmp printable = yes public = yes writable = no create mode = 0700 printcap name = /etc/printcap print command = /usr/bin/lpr -P%p -r %s printing = cups
Some explanation what is done: the [printers] part defines the default-behavior for all the printers that are mentioned in "printcap name". A sort of template how to create shares for these printers. This template is applied if "load printers" is set to true. For more detailed explanation refer to the Samba documentation. And do not forget to reload Samba:
sudo /etc/init.d/samba reload
[[UbuntuHelp:[Top|Back to top]]]
Securing Samba
This section was started to give some general advise on security considerations and is not an exhaustive review of samba security.
/etc/samba/smb.conf
- Networking Section - use "hosts allow" and "hosts deny"
# hosts allow = 127.0.0.1 192.168.1.0/24 hostal allow = 127.0.0.1 192.168.1.1 192.168.1.2 hosts deny = 0.0.0.0/0
hosts deny 0.0.0.0/0 = all others.
- Shares
- When defining a share, consider the following options :
- browseable = no ~ Shares will not show up when browsing your network.
- users = user1 user2 ~ List of users able to access the share
When setting up a Samba share, you can limit the users who have access to your share
[private] comment = Private Share path = /path/to/share/point browseable = no read only = no valid users = user1 user2 user3
Now only samba users user1, user2, and user3 will have access to the share "private".
Firewall
Configure your firewall (iptables) to limit access to your server. Samba uses ports
- UDP ports 137 and 138
- TCP ports 139 and 445
[[UbuntuHelp:[Top|Back to top]]]
Troubleshooting Samba
A common problem when attempting to access a SMB share from a Windows computer is "System Error 53" after attempting to "Net Use".
The first thing you should do, before looking into your conf files, is ensure that the directory you are sharing actually exists.
If you are having problems with Samba users, look into the command pdbedit
This is a very excellent and in-depth guide to Samba troubleshooting. http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch12_:_Samba_Security_and_Troubleshooting
[[UbuntuHelp:[Top|Back to top]]]
Tips / Permissions
Samba permissions are sometimes a little tricky.
Server side
- The name of your samba share is the word on the [ ]
[private] = share name of "private". [secret] = share name of "secret".
- To be able to mount the samba share, samba users on the server must have permission to access the directory.
If /path/to/share/point
in "path = /path/to/share/point" is owned by root.root with permissions of 770 , only root will be able to mount the share.
[[UbuntuHelp:[Top|Back to top]]]
Client side
- If you do not user a credentials file, do not forget to specify your samba_user at the time of mounting ( -o username=samba_user ).
- Permissions on a samba share depend on the Server.
Linux servers will honor full Linux permissions. Windows shares do not support Linux permissions. Set permissions at the time of mounting the samba share with the options file_mode=660 and dir_mode=770 (these are permissions and not umask values):
file_mode=arg If the server does not support the CIFS Unix extensions this over‐ rides the default file mode. dir_mode=arg If the server does not support the CIFS Unix extensions this over‐ rides the default mode for directories.
These options will be used for all files and directories on the (Windows) samba share and can not be changed.
- Permissions of new files on the samba share are set by your umask.
- To mount your samba shares via (server) hostname rather than IP Address, add an entry for your server in /etc/hosts (C:\WINDOWS\system32\drivers\etc\hosts for Windows).
[[UbuntuHelp:[Top|Back to top]]]
Links
- SettingUpSambaPDC
- ActiveDirectoryHowto
- http://www.samba.org/ The Samba web site
- http://us1.samba.org/samba/docs/man/Samba-HOWTO-Collection/ 900+ pg pdf document, seems to be updated daily
- http://us1.samba.org/samba/docs/using_samba/toc.html "Using Samba", by Ts, Eckstein, and Collier-Brown (O'Reilly)
- http://ubuntuguide.org/wiki/Ubuntu:Jaunty#Samba_File_Sharing
- http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch12_:_Samba_Security_and_Troubleshooting "Samba Troubleshooting on linuxhomenetworking.com"
[[UbuntuHelp:[Top|Back to top]]]