samba共享 linux_如何在Linux中轻松创建Samba(Windows)共享

samba共享 linux

samba共享 linux

banner

When you’re using Linux, a popular way to share files with Windows is via Samba. For beginners, it can be a real pain to configure it manually, but with the right tool, it’s as easy as pie.

使用Linux时,与Windows共享文件的一种流行方法是通过Samba。 对于初学者来说,手动配置它可能是一个真正的痛苦,但是使用正确的工具,它就像馅饼一样容易。

Way back in 2007, we showed you how to install Samba on Ubuntu. Things haven’t changed much, except that there are more ways to configure it. If you don’t have Samba installed and you aren’t afraid of the command-line, just follow the first step in that article and rejoin us here for the rest. If that’s a bit too intimidating, just scroll down.

早在2007年,我们就向您展示了如何在Ubuntu上安装Samba 。 事情并没有太大变化,只是有更多配置它的方法。 如果您没有安装Samba并且不担心命令行,则只需按照该文章的第一步进行操作,然后在此处重新加入我们即可。 如果这太吓人了,请向下滚动。

安装Samba配置工具 (Installing the Samba Config Tool)

Since this guide is for beginners, why don’t we go through the Ubuntu Software Center? Open that up, and search for “samba” in the upper-right corner.

既然本指南是针对初学者的,那么为什么不浏览Ubuntu软件中心呢? 打开它,然后在右上角搜索“ samba”。

Ubuntu Software Center_007

(Click screenshot for larger view.)

(单击屏幕快照可查看大图。)

You’ll see a few different packages come up. The first one in our screenshot is the actual Samba package (above the highlighted one), called “SMB/CIFS file, print, and login server for Unix”. If you haven’t installed it yet, now is the time to do so. Just click on it and then click the Install button on the right that comes up.

您会看到一些不同的软件包。 屏幕快照中的第一个是实际的Samba软件包(在突出显示的软件包之上),称为“用于Unix的SMB / CIFS文件,打印和登录服务器”。 如果尚未安装,现在是时候进行安装了。 只需单击它,然后单击出现的右侧的“安装”按钮。

For our tool, however, we want “Samba,” which is the highlighted software. Click on More Info to check it out.

但是,对于我们的工具,我们需要突出显示的软件“ Samba”。 单击更多信息以将其签出。

Ubuntu Software Center_008

(Click screenshot for larger view.)

(单击屏幕快照可查看大图。)

You can see that the package name is “system-config-samba” and that means we’ve got the right one. Just click the Install button. I’ve already got it installed, so I have a “Remove” button in its place.

您会看到软件包名称为“ system-config-samba”,这意味着我们找到了正确的软件包。 只需单击“安装”按钮。 我已经安装了它,所以在它的位置有一个“删除”按钮。

If you want to skip all of that and just use the command-line, here’s what you need to run:

如果要跳过所有这些,而仅使用命令行,则需要运行以下命令:

sudo apt-get install system-config-samba

须藤apt-get install system-config-samba

Once you’re all set up, you can add users and shares!

设置完成后,您可以添加用户和共享!

新增使用者 (Adding Users)

While Samba can work without user accounts (using a “guest” account), it’s best to be safe and enforce password-based use. Each Samba user will need a local account first. We’ve highlighted how to do this using the GUI in a previous article, How To Create a Family-Friendly Ubuntu Setup. You should also be able to do this quickly on the command-line, as outlined in Create a New User on Ubuntu Server 9.10 – don’t worry about the older version number, it still works the same way in Natty.

尽管Samba可以在没有用户帐户(使用“来宾”帐户)的情况下工作,但最好是安全并强制使用基于密码的用法。 每个Samba用户将首先需要一个本地帐户。 在上一篇文章如何创建家庭友好的Ubuntu安装程序中 ,我们重点介绍了如何使用GUI来执行此操作。 您还应该能够在命令行上快速执行此操作,如在Ubuntu Server 9.10上创建新用户中所述–不必担心较旧的版本号,它在Natty中的工作方式仍然相同。

Once you’ve got local user accounts all set up, open up the Samba configuration tool from System > Administration > Samba and entering your root password when prompted.

设置完本地用户帐户后,从系统>管理> Samba打开Samba配置工具,并在出现提示时输入您的root密码。

Samba Server Configuration_009

Go to Preferences > Samba Users.

转到首选项> Samba用户。

Samba Users_022

Here, you can add and delete users by clicking on the appropriate buttons. You can also manually change users’ passwords by clicking Edit User. It’s that easy!

在这里,您可以通过单击适当的按钮来添加和删除用户。 您还可以通过单击“编辑用户”来手动更改用户的密码。 就这么简单!

服务器设定 (Server Settings)

Next, let’s change some server settings to suit our needs. Back at the main screen for our utility, click Preferences > Server Settings.

接下来,让我们更改一些服务器设置以适合我们的需求。 返回我们实用程序的主屏幕,单击首选项>服务器设置。

Server Settings_010

In the Basic tab, you can add your Windows Workgroup name and a description for the Samba server.

在“基本”选项卡中,您可以添加Windows工作组名称和Samba服务器的描述。

Server Settings_011

In the Security tab, we strongly recommend you use User Authentication Mode, as this will allow or disallow shares based on your configured Samba users. We also strongly recommend you encrypt your passwords and disable the guest account. When you’re done, click OK.

在“安全性”选项卡中,强烈建议您使用“用户身份验证模式”,因为这将允许或禁止基于您配置的Samba用户的共享。 我们也强烈建议您加密密码并禁用访客帐户。 完成后,单击“确定”。

新增股份 (Adding Shares)

To add a share, just click the green plus sign on the tool’s main window, or go to File > Add Share.

要添加共享,只需单击工具主窗口上的绿色加号,或转到文件>添加共享。

Create Samba Share_019

Type in the directory you want to share, or click Browse to navigate to it with the mouse. Enter the shared folder’s name and a description. You can leave the share as read-only, or click the check-box to make it writable. You’ll probably also want to make it visible, so you can navigate to it properly on Windows machines from your network.

输入要共享的目录,或单击“浏览”用鼠标导航到该目录。 输入共享文件夹的名称和描述。 您可以将共享保留为只读,或单击复选框以使其可写。 您可能还希望使其可见,因此您可以从网络在Windows计算机上正确导航到它。

Create Samba Share_020

Under the Access tab, you can manually specify users who have access to this share, or you can allow everyone to access it. If you choose “Allow access to everyone” but you specified that user authentication was required from Server Settings, users will still need a valid account and password on this system to access those shares. To add more shared locations, lather, rinse and repeat!

在“访问”选项卡下,您可以手动指定有权访问此共享的用户,或者可以允许所有人访问该共享。 如果选择“允许所有人访问”,但从“服务器设置”中指定需要用户认证,则该系统上的用户仍需要有效的帐户和密码才能访问这些共享。 要添加更多共享位置,请起泡,冲洗并重复!



Setting up Samba on a home Linux server is an ideal way to let everyone share files quickly, easily, and securely inside your home network. Macs won’t be left out, either, as a matter of fact, and everyone can rest easy knowing that it’s simple to manage.

家庭Linux服务器上设置Samba是一种理想的方法,它使每个人都可以在家庭网络中快速,轻松且安全地共享文件。 Mac也不会被遗漏,事实上,每个人都可以轻松自在地知道它易于管理。

Do you have a preferred setup for Samba? Do you user something else instead? Share your thoughts below!

您有Samba的首选设置吗? 您还使用其他内容吗? 在下面分享您的想法!

翻译自: https://www.howtogeek.com/74459/how-to-create-samba-windows-shares-in-linux-the-easy-way/

samba共享 linux

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值