个人工具

“Quick HOWTO : Ch11 : Sharing Resources Using Samba”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
Test Your Windows Client Configuration
 
(未显示6个用户的23个中间版本)
第2行: 第2行:
 
{{Languages|Quick HOWTO : Ch11 : Sharing Resources Using Samba}}
 
{{Languages|Quick HOWTO : Ch11 : Sharing Resources Using Samba}}
  
== Introduction ==
+
== 序言 ==
  
Now that you have Samba up and running, you may want to allow users to share such resources such as floppy drives, directories, and printers via the Samba server. This chapter tells you how to do it all.
+
既然你已经安装和运行了Samba,你可能允许用户通过Samba服务器分享软驱,目录,或者打印机等资源。这篇文章会告诉你该怎么做。
  
 +
== 为Samba PDC添加一台打印机 == 在你的所有计算机之间共享打印机是建立一个家庭网络的优势。这个直接连接打印机和你的PDC的办法不仅使你所有的Windows工作站都能用到打印机,而且能使你的Samba PDC成为一台打印服务器!唯一的潜在限制是你需要在所有网络中Windows客户机上安装打印机驱动。如果是一个很小的家庭网络这没有什么问题,但是如果是一个巨大的团体网络就不太现实。 === 为Linux添加打印机 === 到目前为止,为Linux添加打印机最简单的办法就是将打印机设为默认菜单中能找到的打印机。 例如:我可以用系统配置打印机(Figure 11-1) ,它非常容易被发现而且可以通过命令行访问。 ==== Figure 11-1 打印机构造屏幕。 ==== [[Image:Samba-print.gif|Image:samba-print.gif]] 注意:有时系统配置打印机的图形界面不能按照你预期的那样工作,这取决于环境变量。你可以用命令行临时把必需的变量设置为正确值。假设你的打印机是在本地安装的,步骤如下: # # 移动到下一个按钮可以用tab键,然后 # # # 当“新建一个队列 # ”菜单出现时,给打印机设置一个容易记的名字,选择“本地打印设备”,移动到“下一个”按钮,然后敲回车。 # # 从“安装本地打印 # 设备”菜单中选择“/dev/lp0"假设打印机在并口不支持USB。点击“下一步”按钮到“队列驱动菜单。 # 滚动到你打印机的生产商那个空白,按下‘ENTER’键。再继续滚动到你的模型,并且按‘&lt’,再次输入‘&gt’。现在你已经得到了对驱动的选择。接着选择有“*”标记的那个默认装置。点击‘NEXT’可以进入‘创建一个新的队列’菜单。# 移动到‘FINISH’然后按下‘&lt’,输入‘&gt’。这里会稍微有点慢。在这一步,最好能够进行一次打印测试,以确认一切正常。=== 让Samba自己认出打印机 === 让Samba自己认出可用打印机的最简单方法是通过使用‘Samba SWAT Web’界面。一旦你进入了SWAT:#点击‘打印机’按钮 # 在下拉列表中找到你自己的打印机。如果打印机名字旁边有个‘*’,说明Samba已经自动设定过它了。如果Samba在创建打印机后没有重新启动的话,你可能会看不到设定好的打印机。在这种情况下,请重新启动Samba。现在你可以直接跳到‘在工作站上设定打印机驱动’这个项目了。如果Samba没有自动设定你的打印机,你需要自己编辑或者创建一个。点击‘Commit Changes’以创建一个更新过的 /etc/samba/smb.conf 文件。#点击在屏幕顶部的‘Status’标签,并且重启 smbd 和 nmbd 来重新启动Samba。现在你的打印机就可以被整个工作站使用了。 === 在工作站上设定打印机驱动 === 现在你的打印机已经可以在 Linux上运行了,你还需要准备一些事情以便使它能在 Windows上也可以使用。#从打印机生产商那里下载合适的 Windows用驱动,然后安装它。#找到‘添加打印机’菜单,然后点击‘下一步’。 # 选择‘网络打印机’按钮以进入本地或者网络打印机菜单,再次点击‘下一步’。#你现在应该在‘定位你的打印机’菜单这里了,请点击‘下一步’而不要输入名称,这样你就可以浏览你的打印机了。#在’浏览打印机‘菜单中双击你的 Linux Samba服务器的名称。 你应该可以看到新的打印机了,点击打印机的名称,然后点击‘下一步’。#你可能会看到这句话‘服务器上打印机的驱动没有被正确安装,如果你想要在你的机器上安装驱动,点击‘OK’’幸运的是你预装了驱动程序,那就点击‘OK’吧。 # 当‘添加打印机向导’出现时,选择你打印机生产商的名字,打印机型号,然后点击‘OK’。#‘添加打印机向导’会询问你是否想要设此打印机为默认打印机,根据你的喜好选择‘YES’或者‘NO’,点击‘下一步’#在产生的‘完成添加打印机’菜单中点击‘完成’。现在新的打印机应该在控制面板中的‘Windows打印机’菜单中出现了。现在你可以进行打印测试以保证一切顺利。
  
既然你已经安装和运行了
+
== 在SAMBA中创建群组共享文件 ==
  
  
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====
+
 
+
[[Image:samba-print.gif]]
+
 
+
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.
+
 
+
==Creating Group Shares in SAMBA==
+
 
+
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:
+
1. 新建一个Linux parents组:
  
 
  [root@bigboy tmp]# /usr/sbin/groupadd 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
+
2. 新建一个目录用以保存这个组的文件。如果一个用户被设为领导者,你可能想改变权限来设置他们的所有者。
  
 
  [root@bigboy tmp]# mkdir /home/parent-files
 
  [root@bigboy tmp]# mkdir /home/parent-files
[root@bigboy tmp]# chgrp parents /home/parent-files
+
[root@bigboy tmp]# chgrp parents /home/parent-files
[root@bigboy tmp]# chmod 0770 /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:
+
3. 为这个新建的组添加成员。例如:下面的命令可以为这个群组添加一个名为father的成员:
  
 
  [root@bigboy tmp]# /usr/sbin/usermod -G parents father
 
  [root@bigboy tmp]# /usr/sbin/usermod -G parents father
  
All your members are in the group; now they need to share.
+
&nbsp;所有的成员都在群组里了,现在他们需要共享。
  
===Configure The Share In SWAT===
+
=== 在SWAT中配置共享 ===
  
Next, you need to create the share in Samba using SWAT.
+
接着,你需要用SWAT在Samba建立中共享。
  
# Click on the shares button then enter the name of the share you want to create, such as only-parents.
+
# 点击共享按钮然後输入你想要的共享名称,例如“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.
+
# 点击“新建共享”按钮,路径为/home/parent-files,确定正确的用户名为@parents,parents的是Linux月户组的名字
# 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.
+
# 点击“提交更改”按钮来新建一个路径为
 +
# /etc/samba/smb.conf 的文件
 +
# 点击在屏幕上方的标签“Status(该词不知道该如何翻译)”,然後重启“smbd and nmbd ”来重启Samba。
  
Your /etc/samba/smb.conf file should have an entry like this at the end:
+
<br>你的/etc/samba/smb.conf文件末尾应该有像下边一样的条目:
  
 
  # Parents Shared Area
 
  # 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.
+
[only-parents]
  
===Map The Directory Using "My Computer"===
+
path = /home/parent-files
  
Finally, let the user log into the domain from a remote PC
+
valid users = @parents
  
# Right click on the "My Computer" icon on the desktop
+
<br>如果是,一切正常,你可以继续,如果不是,再次检查你前边几步的工作。
# 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===
+
# 右键单击桌面上的“我的电脑”图标
 +
# 点击“映射网络驱动器”
 +
# 选择一个驱动器字母
 +
#
 +
# 浏览
 +
# HOMENET域,然後是Samba服务器,最後是名为only-parents的共享
 +
# 勾选“登录时重新连接”复选框使设置永远有效。
  
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.
+
<br>现在,位于Linux上/home/parent-files目录只能被群组parents访问,你的工作结束了!
  
====For Windows 98/ME====
+
== Sharing Windows Drives Using a Linux SAMBA Client(用linux SAMBA客户端共享windows驱动) ==
  
# Double click 'My Computer'
+
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.(到此为止,我已经注意到你的linux服务器是一个Samba服务器,但它也可以用Samba的客户端软件模仿windows客户端。)
# 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====
+
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.(比如,你也可以从你的linix box中进入一台windows机器上的cd-rom,dvd,软盘或者硬盘。在这一节中,我将向你演示如何共享一个cd-rom驱动器。)
  
# Double click 'My Computer'
+
=== Windows 的建立 ===
# 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====
+
windows的客户端首先应该被作为一个samba域或工作组的成员来建立。下一步是共享CD-ROM驱动器。这些步骤取决于您使用的windows版本
  
# Double click 'My Computer'
+
====对于 Windows 98/ME ====
# 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.
+
#双击 '我的电脑'
 +
#鼠标指向CD-ROM驱动器,单击鼠标右键 ,选择'共享'
 +
#将共享名设置为 'cdrom',并进行适当的访问控制
 +
#重启windows
  
===Test Your Windows Client Configuration===
+
==== 对于Windows XP ====
  
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:
+
#双击'我的电脑'
 +
#右键点击CD-ROM驱动设备,选择“共享”
 +
#设置共享名为'cdrom',分配适当的存取权限
 +
#注销并用你当前的账号再次登录。
 +
 
 +
当你完成这个过程后,你必须到下一步测试你的设置。
 +
 
 +
==== For Windows 2000 ====
 +
 
 +
=== 测试你的windows客户端设置===
 +
使用smbclient 命令测试你的共享. 你应当用你的Windows客户端名替换‘WinClient’,在'username'处使用一个有效的 工作组/域名 ,它应该能正常访问Windows端。当使用username的相应密码时你应该得到类似于下面的输出。:
  
 
  [root@bigboy tmp]# smbclient -L WinClient -U username
 
  [root@bigboy tmp]# smbclient -L WinClient -U username
第182行: 第135行:
 
  Workgroup Master
 
  Workgroup Master
 
  --------- -------
 
  --------- -------
 +
  
'''Note:''' You can get the result with
+
注意:你也可以用下面的命令获得结果
  
 
  [root@bigboy tmp]# smbclient -L WinClient -U username%password
 
  [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 ===
  
===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.
  
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 ====
  
====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.  
 
+
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]# mkdir /mnt/winclient-cdrom
 
  [root@bigboy tmp]# mount -t smbfs -o username=username \
 
  [root@bigboy tmp]# mount -t smbfs -o username=username \
 
  //winclient/cdrom /mnt/winclient-cdrom
 
  //winclient/cdrom /mnt/winclient-cdrom
 +
  
====No Prompt Method====
+
==== 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.
+
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]# mkdir /mnt/winclient-cdrom
第209行: 第164行:
 
  username=username,password=password \
 
  username=username,password=password \
 
  //winclient/cdrom /mnt/cdrom
 
  //winclient/cdrom /mnt/cdrom
 +
  
====Using The smbmount Command Method====
+
==== 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:
+
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 \
 
  [root@bigboy tmp]# smbmount //winclient/cdrom \
第219行: 第175行:
 
  27875: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
 
  27875: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
 
  SMB connection failed
 
  SMB connection failed
 +
  
 
To be safe, stick with using the Linux mount command.
 
To be safe, stick with using the Linux mount command.
第249行: 第206行:
  
 
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.
 
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.
 +
[[Category:Quick_HOWTO]]

2013年3月4日 (一) 09:51的最新版本


序言

既然你已经安装和运行了Samba,你可能允许用户通过Samba服务器分享软驱,目录,或者打印机等资源。这篇文章会告诉你该怎么做。

== 为Samba PDC添加一台打印机 == 在你的所有计算机之间共享打印机是建立一个家庭网络的优势。这个直接连接打印机和你的PDC的办法不仅使你所有的Windows工作站都能用到打印机,而且能使你的Samba PDC成为一台打印服务器!唯一的潜在限制是你需要在所有网络中Windows客户机上安装打印机驱动。如果是一个很小的家庭网络这没有什么问题,但是如果是一个巨大的团体网络就不太现实。 === 为Linux添加打印机 === 到目前为止,为Linux添加打印机最简单的办法就是将打印机设为默认菜单中能找到的打印机。 例如:我可以用系统配置打印机(Figure 11-1) ,它非常容易被发现而且可以通过命令行访问。 ==== Figure 11-1 打印机构造屏幕。 ==== Image:samba-print.gif 注意:有时系统配置打印机的图形界面不能按照你预期的那样工作,这取决于环境变量。你可以用命令行临时把必需的变量设置为正确值。假设你的打印机是在本地安装的,步骤如下: # # 移动到下一个按钮可以用tab键,然后 # # # 当“新建一个队列 # ”菜单出现时,给打印机设置一个容易记的名字,选择“本地打印设备”,移动到“下一个”按钮,然后敲回车。 # # 从“安装本地打印 # 设备”菜单中选择“/dev/lp0"假设打印机在并口不支持USB。点击“下一步”按钮到“队列驱动菜单。 # 滚动到你打印机的生产商那个空白,按下‘ENTER’键。再继续滚动到你的模型,并且按‘&lt’,再次输入‘&gt’。现在你已经得到了对驱动的选择。接着选择有“*”标记的那个默认装置。点击‘NEXT’可以进入‘创建一个新的队列’菜单。# 移动到‘FINISH’然后按下‘&lt’,输入‘&gt’。这里会稍微有点慢。在这一步,最好能够进行一次打印测试,以确认一切正常。=== 让Samba自己认出打印机 === 让Samba自己认出可用打印机的最简单方法是通过使用‘Samba SWAT Web’界面。一旦你进入了SWAT:#点击‘打印机’按钮 # 在下拉列表中找到你自己的打印机。如果打印机名字旁边有个‘*’,说明Samba已经自动设定过它了。如果Samba在创建打印机后没有重新启动的话,你可能会看不到设定好的打印机。在这种情况下,请重新启动Samba。现在你可以直接跳到‘在工作站上设定打印机驱动’这个项目了。如果Samba没有自动设定你的打印机,你需要自己编辑或者创建一个。点击‘Commit Changes’以创建一个更新过的 /etc/samba/smb.conf 文件。#点击在屏幕顶部的‘Status’标签,并且重启 smbd 和 nmbd 来重新启动Samba。现在你的打印机就可以被整个工作站使用了。 === 在工作站上设定打印机驱动 === 现在你的打印机已经可以在 Linux上运行了,你还需要准备一些事情以便使它能在 Windows上也可以使用。#从打印机生产商那里下载合适的 Windows用驱动,然后安装它。#找到‘添加打印机’菜单,然后点击‘下一步’。 # 选择‘网络打印机’按钮以进入本地或者网络打印机菜单,再次点击‘下一步’。#你现在应该在‘定位你的打印机’菜单这里了,请点击‘下一步’而不要输入名称,这样你就可以浏览你的打印机了。#在’浏览打印机‘菜单中双击你的 Linux Samba服务器的名称。 你应该可以看到新的打印机了,点击打印机的名称,然后点击‘下一步’。#你可能会看到这句话‘服务器上打印机的驱动没有被正确安装,如果你想要在你的机器上安装驱动,点击‘OK’’幸运的是你预装了驱动程序,那就点击‘OK’吧。 # 当‘添加打印机向导’出现时,选择你打印机生产商的名字,打印机型号,然后点击‘OK’。#‘添加打印机向导’会询问你是否想要设此打印机为默认打印机,根据你的喜好选择‘YES’或者‘NO’,点击‘下一步’#在产生的‘完成添加打印机’菜单中点击‘完成’。现在新的打印机应该在控制面板中的‘Windows打印机’菜单中出现了。现在你可以进行打印测试以保证一切顺利。

在SAMBA中创建群组共享文件

有时,家庭中的子群成员需要一种更加容易的共享。例如:父母在家庭办公室工作需要一个共享,分发,合作文件的地方,下面


就是步骤。

新建一个目录和一个用户组

正如任何群体活动中,首要的一步是要成立组织。

1. 新建一个Linux parents组:

[root@bigboy tmp]# /usr/sbin/groupadd parents

2. 新建一个目录用以保存这个组的文件。如果一个用户被设为领导者,你可能想改变权限来设置他们的所有者。

[root@bigboy tmp]# mkdir /home/parent-files

[root@bigboy tmp]# chgrp parents /home/parent-files [root@bigboy tmp]# chmod 0770 /home/parent-files

3. 为这个新建的组添加成员。例如:下面的命令可以为这个群组添加一个名为father的成员:

[root@bigboy tmp]# /usr/sbin/usermod -G parents father

 所有的成员都在群组里了,现在他们需要共享。

在SWAT中配置共享

接着,你需要用SWAT在Samba建立中共享。

  1. 点击共享按钮然後输入你想要的共享名称,例如“only parents”。
  2. 点击“新建共享”按钮,路径为/home/parent-files,确定正确的用户名为@parents,parents的是Linux月户组的名字
  3. 点击“提交更改”按钮来新建一个路径为
  4. /etc/samba/smb.conf 的文件
  5. 点击在屏幕上方的标签“Status(该词不知道该如何翻译)”,然後重启“smbd and nmbd ”来重启Samba。


你的/etc/samba/smb.conf文件末尾应该有像下边一样的条目:

# Parents Shared Area

[only-parents]

path = /home/parent-files

valid users = @parents


如果是,一切正常,你可以继续,如果不是,再次检查你前边几步的工作。

=

用“我的电脑”

映射网络目录

最後,让用户远程登录。

  1. 右键单击桌面上的“我的电脑”图标
  2. 点击“映射网络驱动器”
  3. 选择一个驱动器字母
  4. 浏览
  5. HOMENET域,然後是Samba服务器,最後是名为only-parents的共享
  6. 勾选“登录时重新连接”复选框使设置永远有效。


现在,位于Linux上/home/parent-files目录只能被群组parents访问,你的工作结束了!

Sharing Windows Drives Using a Linux SAMBA Client(用linux SAMBA客户端共享windows驱动)

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.(到此为止,我已经注意到你的linux服务器是一个Samba服务器,但它也可以用Samba的客户端软件模仿windows客户端。)

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.(比如,你也可以从你的linix box中进入一台windows机器上的cd-rom,dvd,软盘或者硬盘。在这一节中,我将向你演示如何共享一个cd-rom驱动器。)

Windows 的建立

windows的客户端首先应该被作为一个samba域或工作组的成员来建立。下一步是共享CD-ROM驱动器。这些步骤取决于您使用的windows版本

对于 Windows 98/ME

  1. 双击 '我的电脑'
  2. 鼠标指向CD-ROM驱动器,单击鼠标右键 ,选择'共享'
  3. 将共享名设置为 'cdrom',并进行适当的访问控制
  4. 重启windows

对于Windows XP

  1. 双击'我的电脑'
  2. 右键点击CD-ROM驱动设备,选择“共享”
  3. 设置共享名为'cdrom',分配适当的存取权限
  4. 注销并用你当前的账号再次登录。

当你完成这个过程后,你必须到下一步测试你的设置。

For Windows 2000

测试你的windows客户端设置

使用smbclient 命令测试你的共享. 你应当用你的Windows客户端名替换‘WinClient’,在'username'处使用一个有效的 工作组/域名 ,它应该能正常访问Windows端。当使用username的相应密码时你应该得到类似于下面的输出。:

[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
--------- -------

注意:你也可以用下面的命令获得结果

[root@bigboy tmp]# smbclient -L WinClient -U username%password

但这个方法缺乏安全性,因为你的密码被回显在屏幕上。

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.