translated

This commit is contained in:
KayGuoWhu 2015-03-15 15:24:08 +08:00
parent cd7803df52
commit a8ef75d88d
2 changed files with 176 additions and 178 deletions

View File

@ -1,178 +0,0 @@
[translating by KayGuoWhu]
Share Folders On Local Network Between Ubuntu And Windows
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_windows.jpeg)
This is a complete tutorial to show you **how to share folders over local network in Ubuntu**.
Do you have multiple devices in your home? Do you have to use Flash Drive or SD card to transfer data from Ubuntu to another computer? Do you find it annoying? We know you do. Because we dont want you to waste your precious time while you can transfer your files, documents and other large stuff quickly and easily, over the local network. Its one time setup and then with some clicks you will be able to **share files between Ubuntu and Windows** or any other Linux system. And dont worry its easy and takes only little time.
One more thing to add, while we performed this tutorial on Ubuntu, this tutorial should be valid for any other Linux OS.
#### Share folder on local network in Ubuntu ####
If you are using Ubuntu 14.04, 14.10 or 12.04, there are two ways you can share your local files over the local network to access it from Windows or other Linux computers.
- Share it for everyones access on local network, without password
- Password protect the folders for restricted access
Well see both methods in this post and will let you decide which one you would prefer to use.
### 1. Share folders on local network without password ###
#### Step 1: ####
To share a folder on local network in Ubuntu, right click on the desired folder and select Local Network Share:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Share_Folder_Ubuntu.jpeg)
**Possible troubleshoot**: If do not see the option of Local Network Share in right click menu, open a terminal and use the following command to install nautlius-share:
sudo apt-get install nautilus-share
Youll need to restart Nautilus. Either log out and log in back or use the command below:
nautilus -q
#### Step 2: ####
When you click on Local Network Share, you will see the option of sharing the folder. Just check the option of Share this folder:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_1.jpeg)
Possible troubleshoot: If you are prompted about Sharing service not being installed, like in the screenshot below, just click on Install service and follow the instructions.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_2.jpeg)
#### Step 3: ####
When you check the option of Share this folder, youll see option of Create Share available for you. You can also allow other users to edit the files in the shared folder. Option for guest access can be checked as well.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_folder_Ubuntu_3.png)
Youll see that the folder icon have been changed to show that it has been shared. To stop sharing a folder, just uncheck the Share this folder option.
Now this was the easy way out. This provides access to anyone on your local network to access these files. In normal condition, you should prefer this. I mean, devices on your home network should be generally know devices. But this could not be the case always. What if you want only certain people to access it? This is where Samba server comes in picture. Well see that in the second part of the tutorial.
### 2. Share the folders on local network in Ubuntu with password protection ###
To do this, we need to configure Samba server. Actually, we did use Samba in the previous part of this tutorial. We just did not emphasize on it. Before we go on seeing how to set up Samba server for local network sharing in Ubuntu, lets first have a quick look on what actually is [Samba][1].
#### What is Samba? ####
Samba is the software package that allows you to share files, documents and printers across a network, irrespective of whether you are using Linux, Windows and Mac. Its available for all major platforms and can work tremendously nice in all of them. Quoting from Wikipedia:
> Samba a free software re-implementation of the SMB/CIFS networking protocol, and was originally developed by Andrew Tridgell. As of version 3, Samba provides file and print services for various Windows Clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part an Active Directory domain.
#### Install Samba server on Ubuntu ####
You can easily install Samba on you Ubuntu box. Before installing update your system so that you can install any available updates.
sudo apt-get update && apt-get upgrade
Now install Samba serer and few other required stuffs with the following command:
sudo apt-get install samba samba-common system-config-samba python-glade2 gksu
Once youve installed Samba server, its time to configure Samba from the graphical interface window to share files.
#### Configure Samba server on Ubuntu ####
Open Samba Configuration tool from the dash:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Setup-Samba.png)
Go to **Preference->Server Settings**. Although the default settings are good and may be same you need. But you may need to make change to it in some cases.
Now in Server Settings youve two tabs, Basic and Security. Under Basic tab youve the following options that mean:
- Workgroup This is the name of the Workgroup of the computer you want to connect to. For example, if you want to connect to a Windows computer so you will enter the workgroup name of Windows computer, and in Windows you already have the same workgroup name as is set by default in Samba Server Settings. But if you have a different workgroup name on Windows then you will enter that workgroup name in this field. (In Windows 7 to get the workgroup name, right-click Computer icon and go to Properties, there youll see Windows Workgroup name.)
- Description This is the name of your computer as seen by others. Dont use spaces or non-internet friendly characters.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-server-settings.png)
setting up samba serverAllowing Guests is not advisable so there is no reason to change security settings. Keep as it is.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Samba-Security-Settings-compressed.jpg)
Samba Security security settingsIt is all done! Youve setup Samba Server. We are not far from sharing our first folder on network.
#### Create a system user for network file sharing ####
We will now create a system user for sharing file on network. This is how simple it is.
- Go to **System Settings**.
- Under Systems Settings Click **User Accounts**.
- Click **unlock** to Enable + (**plus**) icon.
- Click + (plus) icon to create a new system user.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/create-system-user1.jpg)
Now as you can see the above image, you can enter Full name. As you enter Full name Username will be taken as Full name automatically. Because we are creating this user to share files so we will assign Account Type to **Standard**.
Done above steps? Click add. You have created a system user. The user is not yet activated so we will activate it by setting up password for this account. Make sure Users accounts panel is unlocked. Click Account disabled and type a new password, then confirm password and click Change.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/activate-system-user.jpg)
Yipee… Upto now we have installed and configured Samba and We have created a System user to share files on network from the account and we have activated our newly created account, too. Now We will move to Samba for the last step of configuring everything, then we will share a folder.
#### Add new Samba user ####
Open Samba and click Samba Users under Preference. Fill up the the simple dialogue. Here are couple of details about the fields:
**Unix Username** In this case I am selecting the user that I just created.
**Windows Username** You will enter this username when you are accessing from Windows Machine.
**Samba Password** You will enter this password when you are accessing from Windows Machine.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-user-setting.jpg)
Once youve done click OK. Now take a deep breath. You have successfully created a network with the help of Samba. Now restart the network or Samba services and ready to share files with other machines.
sudo restart smbd && sudo restart nmbd
#### Share folders or files over the network ####
To share files with Samba its simple with graphical user interface. Click the Plus icon in Samba and you will get dialogue like this:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/share-files-and-folders.jpg)
share files and folders over network with sambaComplete the fields. In Directory browse the folder you want to share. Here are the details about the fields you will see here:
- **Share name** is the name of the folder that other would see.
- **Description** is simply about the content you are sharing on network.
- **Writable** You shared folders are read only by default. You can set them to writable if you want others on network to change them.
- **Visible** As the name suggests when you click Visible, the shared folder will be visible to the people on network.
Now you can set permissions for the folder you are sharing. To do this click Access tab and check the users you want to share the folder with. When you select Allow access to everyone, the folder will be accessible to everyone on the network.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Screenshot-from-2015-02-28-202031.png)
Finally click OK to complete the sharing. Now the folder is shared with the people you want. You have completed sharing file on network. Is there everything left? Yes! How to remove the folders from the network?
#### Remove shared folders ####
We will also need to remove some of the folders after sometime from network. It is very simple and here is how we can do that.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/remove-shared-folder-from-network.jpg)
This is all done! We can also share files over network using terminal but that would not be as easy as this one. If you request for command line sharing then I will write a tutorial on how to share files over network with command line in Linux.
So, how do you find this tutorial to share files on local network in Ubuntu? I hope with this tutorial you can **easily share files between Ubuntu and Windows**. If you have questions or suggestions, feel free to ask it in the comment box below.
This tutorial was requested by Kalc. If you would like, you can [request your own tutorial][2]. We would be happy to help you out along with other readers facing the same issue.
--------------------------------------------------------------------------------
via: http://itsfoss.com/share-folders-local-network-ubuntu-windows/
作者:[Mohd Sohail][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/sohail/
[1]:http://en.wikipedia.org/wiki/Samba_%28software%29
[2]:http://itsfoss.com/request-tutorial/

View File

@ -0,0 +1,176 @@
局域网中实现Ubuntu和Windows共享文件夹
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_windows.jpeg)
本文全面详细地向你描述了**在Ubuntu中如何实现局域网内的文件夹共享**。
你的家中是不是有多台电脑当你需要从一台Ubuntu电脑向另一台电脑传输数据时是不是必须用到U盘或SD卡你是否也觉得这个方法很烦人我想肯定是。本文的目的就是使你在局域网内快速方便地传输文件、文档和其它较大的数据来节省你的宝贵时间。只需一次设置然后轻点鼠标你就可以自由地**在Ubuntu和Windows之间共享文件**当然这对其它Linux系统同样使用。不要担心这很容易操作不会花费太多时间。
除此之外尽管本文是在Ubuntu上进行实践但这个教程在其它Linux系统上同样有用。
#### 在Ubuntu上实现局域网共享文件夹 ####
如果你的系统是Ubuntu 14.04、14.10或12.04有两个方法可以使你通过局域网在搭载Windows或其他Linux的电脑上共享本地文件。
- 对局域网中的每个用户提供无密码共享
- 仅限特定访问,提供文件夹密码保护
这篇文章包括两种方法,你可以选择你想用的那种。
### 1. 局域网无密码共享文件夹 ###
#### 步骤一:####
为了在Ubuntu上实现局域网共享文件夹右键点击打算共享的文件夹并选择“Local Network Share”
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Share_Folder_Ubuntu.jpeg)
**可能有用的故障方案**如果在右键菜单中看不到“Local Network Share”的选项那就新建一个终端使用下面的命令去安装nautlius-share
sudo apt-get install nautilus-share
然后重启Nautilus。可以选择注销再登录或者使用这个命令:
nautilus -q
#### 步骤二:####
一旦点击“Local Network Share”就会出现共享文件夹的选项。只需选中“Share this folder”这一项
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_1.jpeg)
可能的故障方案:如果提示共享服务还未安装,就像下图所示,那就点击安装服务,按照提示操作。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_2.jpeg)
#### 步骤三:####
一旦选中“Share this folder”的选项就会看到按钮“Create Share”变成可用了。你也可以允许其他用户在共享文件夹中编辑文件。选项“Guest access”也是如此。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_folder_Ubuntu_3.png)
你会看到文件夹图标已经显示为共享的。如果要停止共享文件夹只需取消“Share this floder”这个选项。
这个方法就是这么简单使得局域网中的任何人都可以访问共享文件夹中的文件。在正常情况下你会选择这种方式。因为家用局域网中的电脑通常都是可信电脑。但情况也不总是这样。如果你只是想特定的用户才能访问怎么办这个时候就需要Samba服务器了。我们在本文的第二部分讨论这种方法。
### 2. 在Ubuntu上使用密码保护实现局域网共享文件夹###
为了达到目的首先需要配置Samba服务器。事实上在这篇教程的前一部分我们已经用到了Samba只是我们没有刻意强调。在介绍如何在Ubuntu上搭建Samba服务器实现局域网共享的方法之前先快速预览一下[Samba][1]到底是什么。
#### Samba是什么 ####
Samba是一个允许用户通过网络共享文件、文档和打印机的软件包无论是在Linux、Windows还是Mac上。它适用于所有的主流平台可以在所有支持系统上流畅运行。下面是维基百科的介绍
> Samba是一款重新实现SMB/CIFS网络协议的自由软件最初由安德鲁·垂鸠开发。在第三版中Smaba不仅支持通过不同的Windows客户端访问及分享SMB的文件夹及打印机还可以集成到Windows Server域名作为主要域名控制站PDC或者域名成员。它也可以作为Active Directory域名的一部分。
#### 在Ubuntu上安装Samba服务器 ####
你可以很方便地在Ubuntu电脑上安装Samba。安装前请先更新系统以便安装任何可用的更新。
sudo apt-get update && apt-get upgrade
然后按照这条命令安装samba和少量所需的软件包
sudo apt-get install samba samba-common system-config-samba python-glade2 gksu
一旦安装完成Samba服务器就可以从图形界面配置Samba来分享文件。
#### 在Ubuntu上配置Samba服务器 ####
从dash打开Samba配置工具
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Setup-Samba.png)
进入到**Preference->Server Settings**。尽管默认已经设置好,可能就是你需要的。但在某些情况下你可能需要做一些改动。
在Server Setting中可以看到两个选项卡BasicSecurity。在Basic选项卡下的选项含义如下
- 工作组 - 用户要连接的电脑所在工作组的名字。比如如果你想连接到一台Windows电脑你就要输入Windows电脑的工作组名字。在Windows的Samba服务器设置中已经默认设置好统一的工作组名字。但如果你有不同的工作组名字就在这个字段中输入自定义的工作组名字。在Windows 7中获取工作组名字右击计算机图标进到属性就能看到Windows工作组名字。
- 描述 - 其他用户看到的你的电脑名字。不要使用空格或计算机不支持(望更正!)的字符。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-server-settings.png)
设置samba服务器允许Guests可用是不明智的所以没必要修改安全设置保持原样即可。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Samba-Security-Settings-compressed.jpg)
这就搞定了你已经搭建好Samba服务器距离实现网络共享第一个文件夹的目标不远了
#### 为网络文件共享创建一个系统用户 ####
现在我们需要为网络共享文件创建一个系统用户。下面是非常简单的步骤:
- 在Systems Settings下点击**User Accounts**。
- 点击**unlock**使其可用,以及+**plus**)图标。
- 点击+plus图标创建一个新的系统用户。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/create-system-user1.jpg)
如上图所示需要输入Full name。当你输入Full nameUsername会自动填充为Full name。因为创建这个用户是为了共享文件所以还要指定Account Type为**Standard**’。
完成上述步骤点击添加你就创建好一个系统用户。这个用户还没有被激活所以需要为其设置密码来激活。确保Users accounts界面已经解锁。点击Account disabled。输入一个新密码然后确认密码点击Change。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/activate-system-user.jpg)
到目前为止我们已经安装并配置好Samba已经创建了一个系统用户以通过这个账户在网络上共享文件而且也已经激活了新用户。现在来到配置Samba的最后一步然后就可以共享文件夹了。
#### 添加Samba新用户 ####
打开Samba在Preference先点击Samba Users。填写弹出的对话框下面是其中几个字段的说明
**Unix Username** - 在这种情况下,我选择刚才创建的用户。
**Windows Username** - 输入你要访问的Windows电脑的用户名。
**Samba Password** - 输入你要访问的Windows电脑的密码。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-user-setting.jpg)
完成后点击OK。现在做个深呼吸。你已经在Samba的帮助下成功创建一个网络。然后重启网络或Samba服务准备好和其它电脑共享文件。
sudo restart smbd && sudo restart nmbd
#### 通过网络共享文件夹或文件 ####
在图形用户界面下通过Samba共享文件是很简单的。点击Plus图标会看到如图所示的对话框
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/share-files-and-folders.jpg)
填写完这些字段。在Directory浏览要共享的文件夹。你会看到的字段的含义如下
- **Share name** 是其它人会看到的文件夹名字。
- **Description** 是要共享内容的简单描述。
- **Writeable** 默认情况下共享的文件夹是read only。如果允许网络上的其他用户修改它们设置为writable。
- **Visiable** 当你点击Visiable时就像它的名字一样共享文件夹就对网络上的其他人可见。
现在你可以设置共享文件夹的权限。点击Access选项选择想要共享文件夹的用户。当你选择对所有人允许访问后这个文件夹就对网络上的所有人可见。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Screenshot-from-2015-02-28-202031.png)
最后点击OK完成共享。现在这个文件夹就与你想要共享的用户实现共享。你已经完成了网络共享文件。还有其它要做的吗还不知道如何从网络上移除文件夹
#### 移除共享文件夹 ####
在网络共享一段时间后,我们也需要移除其中的一些文件夹。操作很简答,下面就是我们要做的。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/remove-shared-folder-from-network.jpg)
全部搞定我们也可以使用终端进行网络文件共享但这样没有本文介绍的方法这么容易。如果你确实想知道命令行操作我会再写一篇关于在Linux上使用命令行实现网络文件共享的文章。
所以,你是怎么找到这篇教程的呢?我希望看了这篇教程你可以**很容易地在Ubuntu和Windows之间共享文件**。如果你有任何问题或建议,请再评论里说出来。
这篇教程是在Kalc的请求下写出的。如果你也想你可以[请求你自己的教程][2]。我们很乐意帮助你和面临同样问题的读者解决问题。
--------------------------------------------------------------------------------
via: http://itsfoss.com/share-folders-local-network-ubuntu-windows/
作者:[Mohd Sohail][a]
译者:[KayGuoWhu](https://github.com/KayGuoWhu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/sohail/
[1]:http://en.wikipedia.org/wiki/Samba_%28software%29
[2]:http://itsfoss.com/request-tutorial/