Quick HOWTO : Ch11 : Sharing Resources Using Samba
文章出处: |
{{#if: | {{{2}}} | http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch11_:_Sharing_Resources_with_Samba }} |
点击翻译: |
English {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/af | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Afrikaans| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/af|Afrikaans]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ar | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|العربية| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ar|العربية]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/az | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|azərbaycanca| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/bcc | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|جهلسری بلوچی| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/bg | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|български| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/bg|български]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/br | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|brezhoneg| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/br|brezhoneg]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ca | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|català| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ca|català]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/cs | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|čeština| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/cs|čeština]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/de | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Deutsch| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/de|Deutsch]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/el | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Ελληνικά| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/es | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|español| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/es|español]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/fa | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|فارسی| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/fa|فارسی]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/fi | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|suomi| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/fi|suomi]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/fr | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|français| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/fr|français]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/gu | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|ગુજરાતી| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/he | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|עברית| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/he|עברית]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/hu | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|magyar| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/hu|magyar]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/id | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Bahasa Indonesia| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/it | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|italiano| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/it|italiano]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ja | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|日本語| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ja|日本語]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ko | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|한국어| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ko|한국어]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ksh | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Ripoarisch| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/mr | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|मराठी| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/mr|मराठी]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ms | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Bahasa Melayu| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/nl | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Nederlands| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/nl|Nederlands]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/no | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|norsk| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/no|norsk]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/oc | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|occitan| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/oc|occitan]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/pl | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|polski| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/pl|polski]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/pt | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|português| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/pt|português]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ro | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|română| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ro|română]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/ru | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|русский| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/ru|русский]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/si | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|සිංහල| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/si|සිංහල]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/sq | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|shqip| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/sq|shqip]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/sr | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|српски / srpski| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/sv | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|svenska| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/sv|svenska]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/th | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|ไทย| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/th|ไทย]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/tr | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Türkçe| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/tr|Türkçe]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/vi | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|Tiếng Việt| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/yue | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|粵語| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/yue|粵語]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/zh | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|中文| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/zh|中文]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/zh-hans | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|中文(简体)| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba | Quick HOWTO : Ch11 : Sharing Resources Using Samba | {{#if: | :}}Quick HOWTO : Ch11 : Sharing Resources Using Samba}}/zh-hant | • {{#if: Quick HOWTO : Ch11 : Sharing Resources Using Samba|中文(繁體)| [[::Quick HOWTO : Ch11 : Sharing Resources Using Samba/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:Quick HOWTO : Ch11 : Sharing Resources Using Samba|:Quick HOWTO : Ch11 : Sharing Resources Using Samba|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Quick HOWTO : Ch11 : Sharing Resources Using Samba/zh | | {{#ifexist: Quick HOWTO : Ch11 : Sharing Resources Using Samba/zh | | {{#ifeq: {{#titleparts:Quick HOWTO : Ch11 : Sharing Resources Using Samba|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Quick HOWTO : Ch11 : Sharing Resources Using Samba|1|-1|}} | zh | | }}
序言
既然你已经安装和运行了Samba,你可能允许用户通过Samba服务器分享软驱,目录,或者打印机等资源。这篇文章会告诉你该怎么做。
Adding A Printer To A Samba PDC
Sharing printers amongst all your PCs is one of the advantages of creating a home network. Here's how to connect your printer directly to your PDC Not only does this method make your printer available to all your Windows workstations, it also makes your Samba PDC a print server! The only potential snag is that you need the Windows printer driver loaded on every client machine. This may be okay for a small home network but impractical for a huge corporate network.
Adding The Printer To Linux
By far, the easiest way to add a printer in Linux is to use one of the many menu-based printer utilities available. For the example, I'll use system-config-printer (Figure 11-1), which is easy to find and can be accessed from the command line:
[root@bigboy tmp]# system-config-printer
Figure 11-1 Printer Configuration Screen
Note: Sometimes the graphics in system-config-printer don't work as expected due to your environment variables. You can temporarily set the required variable to the correct the output with the command:
[root@bigboy tmp]# env LANG=C system-config-printer
Assuming your printer is locally attached to the parallel port. Here are the steps to use:
- Using the tab key, move to the New button and press the Enter key.
- When the "Create a New Queue" menu appears give the printer name that's easy to remember, select "Local Printer Device" and move to the "next" button before pressing Enter.
- From the resulting "Setting Up Local Printer Device" menu select /dev/lp0 assuming the printer is on the parallel port as opposed to a USB port. Click the "next" button to go to the "Queue Driver" menu.
- Scroll to your manufacturer's entry, press Enter. Scroll further to your model, and press <Enter> again. You'll now get a choice of drivers, select the default device , which is marked with an asterisk (*). Click the "Next" button to go to the "Create a New Queue" menu.
- Move to the "Finish" button and press <Enter>. There will be a slight delay.
At this stage, it's wise to do a test print to make sure all is okay.
Make Samba Aware of the Printer
The easiest way to let Samba know the printer is available is via the Samba SWAT Web interface. Once you are in SWAT:
- Click the "Printers" button
- Find your printer in the pull-down menu. If the printer name has an asterisk (*) beside it, it has been auto-configured by Samba. It might not be visible on your network, however, if Samba hasn't been restarted since creating the printer. If this is the case, restart Samba. You can now skip ahead to the "Configure the Printer Driver on the Workstations" section.
- If Samba did not auto-configure your printer, you need to edit or create it yourself. Click on the "Commit Changes" button to create an updated /etc/samba/smb.conf file.
- Click on the "Status" tab at the top of the screen and restart smbd and nmbd to restart Samba.
Your printer will now be available for use by all Windows workstations.
Configure The Printer Driver On The Workstations
With the printer ready to go on the Linux side, you now need to prepare things in Windows.
- Download the appropriate Windows printer driver from the manufacturer and install it.
- Go to the Add Printer menu. Click the Next button.
- Select the Network Printer button to access the Local or Network Printer menu. Click the Next button, again.
- You now should be on the Locate Your Printer menu. Don't enter a name, instead click Next so you can browse for your printer.
- From the Browse for Printer menu, Double-click on the name of your Linux Samba server. You should see the new printer. Click on the printer name, then click Next.
- You may get the message "The server on which the printer resides does not have the correct printer driver installed. If you want to install the driver on your local computer, click OK." Fortunately, you pre-installed the driver. Click the OK button.
- When the "Add Printer Wizard" appears, select the manufacturer of your printer, select the printer model, and then click OK.
- The "Add Printer Wizard" will ask you whether you want to use this new printer as the default printer. Select Yes or No depending on your preference. Click the Next button
- From the resulting "Completing the Add Printer Wizard" menu, click the Finish button.
The new printer should now show up on the Windows Printers menu in the Control Panel. Send a test print, to be sure all is well.
On occasion, subgroups of a family need a share that is fully accessible by all members of the group. For example, parents working in a home office environment may need a place where they can share, distribute, or collaboratively work on documents. Here's how it's done.
Create The Directory And User Group
As with any group activity, the first step is to get organized.
1. Create a new Linux group parents:
[root@bigboy tmp]# /usr/sbin/groupadd parents
2. Create a new directory for the group's files. If one user is designated as the leader, you might want to change the chown statement to make them owner
[root@bigboy tmp]# mkdir /home/parent-files [root@bigboy tmp]# chgrp parents /home/parent-files [root@bigboy tmp]# chmod 0770 /home/parent-files
3. Add the group members to the new group. For instance, the command to add a user named father to the group is:
[root@bigboy tmp]# /usr/sbin/usermod -G parents father
All your members are in the group; now they need to share.
Next, you need to create the share in Samba using SWAT.
- Click on the shares button then enter the name of the share you want to create, such as only-parents.
- Click on the "Create Share" button. Make sure the path maps to /home/parent-files and make the valid users be @parents, where parents is the name of the Linux user group.
- Click on the "Commit Changes" button to create a new /etc/samba/smb.conf file.
- Click on the "Status" tab at the top of the screen and restart smbd and nmbd to restart Samba.
Your /etc/samba/smb.conf file should have an entry like this at the end:
# Parents Shared Area [only-parents] path = /home/parent-files valid users = @parents
If it does, all is well and you can move on. If not, double check your work in the last steps.
Map The Directory Using "My Computer"
Finally, let the user log into the domain from a remote PC
- Right click on the "My Computer" icon on the desktop
- Click on "Map Network Drive"
- Select a drive letter.
- Browse to the HOMENET domain, then the Samba server, then the share named only-parents
- Click on the check box "Reconnect at Logon", to make the change permanent.
Now the files located in the Linux /home/parent-files directory will be accessible to the parents only and your job is complete!
Sharing Windows Drives Using a Linux SAMBA Client
Up to this point I have focused on your Linux server being a Samba server, but it can also mimic a Windows client using Samba's client software.
For example, you can also access a CD-ROM, DVD, ZIP, floppy or hard drive installed on a Windows machine from your Linux box. In this section I'll show you how to share a CD-ROM drive.
Windows Setup
The Windows client box should be setup first as a member of a Samba domain or workgroup. The next step is to make the CD-ROM drive shared. The steps you used depend on which version of Windows you have.
For Windows 98/ME
- Double click 'My Computer'
- Right click on the CD-ROM drive and choose 'Sharing'
- Set the Share Name as 'cdrom' with the appropriate access control
- Restart windows
For Windows 2000
- Double click 'My Computer'
- Right click on the CD-ROM drive and choose 'Sharing'
- Set the Share Name as 'cdrom' and the appropriate access control
- Logout and login again as normal using your current login
For Windows XP
- Double click 'My Computer'
- Right click on the CD-ROM drive and choose 'Sharing and Properties'
- Set the Share Name as 'cdrom' and the appropriate access control
- Logout and login again as normal using your current login
After you have completed this task, you'll have to go to the next step of testing your configuration.
Test Your Windows Client Configuration
Use the smbclient command to test your share. You should substitute the name of your Windows client PC for "WinClient," and in place of "username" provide a valid workgroup/domain username that normally has access to the Windows client. You should get output like this when using the username's corresponding password:
[root@bigboy tmp]# smbclient -L WinClient -U username added interface ip=192.168.1.100 bcast=192.168.1.255 nmask=255.255.255.0 added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0 Got a positive name query response from 192.168.1.253 ( 192.168.1.253 ) Password: Domain=[HOMENET] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] Sharename Type Comment --------- ---- ------- IPC$ IPC Remote IPC D$ Disk Default share print$ Disk Printer Drivers SharedDocs Disk cdrom Disk Printer2 Printer Acrobat PDFWriter ADMIN$ Disk Remote Admin C$ Disk Default share Server Comment --------- ------- Workgroup Master --------- -------
Note: You can get the result with
[root@bigboy tmp]# smbclient -L WinClient -U username%password
But this method is less secure as your password is echoed on the screen.
Create A CD-ROM Drive Mount Point On Your Samba Server
You'll now need to create the mount point on the Linux server to mount and access the CD-ROM drive. In this case, I've named it /mnt/winclient-cdrom, and you'll use the mount command to get access to this device from the Linux server.
Password Prompt Method
The Linux mount command will try to access the CD-ROM device as user "username" by using the "username=" option. You will be prompted for a password.
[root@bigboy tmp]# mkdir /mnt/winclient-cdrom [root@bigboy tmp]# mount -t smbfs -o username=username \ //winclient/cdrom /mnt/winclient-cdrom
No Prompt Method
Linux won't prompt you for a password if you embed the access password into the mount command string along with username as in the example below.
[root@bigboy tmp]# mkdir /mnt/winclient-cdrom [root@bigboy tmp]# mount -t smbfs -o \ username=username,password=password \ //winclient/cdrom /mnt/cdrom
Using The smbmount Command Method
Some versions of Linux support the smbmount command to mount the remote drive. Incompatible versions will give errors like this:
[root@bigboy tmp]# smbmount //winclient/cdrom \ /mnt/winclient-cdrom -o username=username Password: 27875: session setup failed: ERRDOS - ERRnoaccess (Access denied.) SMB connection failed
To be safe, stick with using the Linux mount command.
Automating Mounting With Linux SAMBA Clients
You can also automate the mounting of shares by placing entries in your /etc/fstab file. In the example below the home directory of user peter on server 192.168.1.100 will be mounted on the /mnt/smb mount point as a samba filesystem (smbfs) using the login information in the file named /etc/cred.
# # File: /etc/fstab # //192.168.1.100/peter /mnt/smb smbfs credentials=/etc/cred 0 0
The contents of the /etc/cred file needs to have the username and password for the account in this format:
# # File: /etc/cred # username = peter password = peterspassword
Once finished you can use the mount -a to mount the new /etc/fstab entry, and the /mnt/smb directory will now contain the contents of the share.
[root@smallfry tmp]# mount -a [root@smallfry tmp]# ls /mnt/smb backups profile docs data music [root@smallfry tmp]#
Conclusion
Both this chapter and the last have detailed the steps needed to configure a Samba network that is adequate for a small office or home. There are many steps to take, none are particularly complex, but you run the risk of not getting Samba to work if you omit any of them. For this reason, the next chapter is a dedicated troubleshooting guide to help you diagnose and recover from the most common Samba mistakes that we all tend to make.