如何在ubuntu下使用samba创建共享
快速简单的创建共享,比网上那些乱七八糟过时的文档强太多
How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal) - Uncomplicated, Simple and Brief Way!

In this text, I teach how to create a network share via Samba using the CLI (Command-line interface/Linux Terminal) in an uncomplicated, simple and brief way targeting Windows users.
Procedures
All commands must be done as root (precede each command with 'sudo' or use 'sudo su').
- Install Samba
- sudo apt-get update
- sudo apt-get install samba
- Set a password for your user in Samba
- sudo smbpasswd -a <user_name>
- Note: Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so you'll need to create a Samba password for yourself. This tutorial implies that you will use your own user and it does not cover situations involving other users passwords, groups, etc...
Tip1: Use the password for your own user to facilitate.
Tip2: Remember that your user must have permission to write and edit the folder you want to share.
Eg.:
sudo chown <user_name> /var/opt/blah/blahblah
sudo chown :<user_name> /var/opt/blah/blahblah
Tip3: If you're using another user than your own, it needs to exist in your system beforehand, you can create it without a shell access using the following command :
sudo useradd USERNAME --shell /bin/false
You can also hide the user on the login screen by adjusting lightdm's configuration, in /etc/lightdm/users.conf add the newly created user to the line :
hidden-users=
- Create a directory to be shared
mkdir /home/<user_name>/<folder_name>
- Make a safe backup copy of the original smb.conf file to your home folder, in case you make an error
sudo cp /etc/samba/smb.conf ~
- Edit the file "/etc/samba/smb.conf"
sudo nano /etc/samba/smb.conf
- Once "smb.conf" has loaded, add this to the very end of the file:
- [<folder_name>]
- path = /home/<user_name>/<folder_name>
- available = yes
- valid users = <user_name>
- read only = no
- browseable = yes
- public = yes
- writable = yes
Tip: There Should be in the spaces between the lines, and note que also there should be a single space both before and after each of the equal signs.
- Restart the samba:
sudo service smbd restart
- Once Samba has restarted, use this command to check your smb.conf for any syntax errors
testparm
- To access your network share
To access your network share use your username (<user_name>) and password through the path "smb://<HOST_IP_OR_NAME>/<folder_name>/" (Linux users) or "\\<HOST_IP_OR_NAME>\<folder_name>\" (Windows users). Note that "<folder_name>" value is passed in "[<folder_name>]", in other words, the share name you entered in "/etc/samba/smb.conf".
- Note: The default user group of samba is "WORKGROUP".
Source
如何在ubuntu下使用samba创建共享的更多相关文章
- Ubuntu下添加Samba用户名与密码
参考: ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录 增加samba用户提示Failed to add entry for user Ubuntu可以直接在 ...
- 如何在ubuntu下使用windows下的程序(eg: .exe)
为了在ubutu下安装百度云管家,上网查了下如何在ubuntu 下安装.exe文件,其中遇到一些问题记录如下: 使用的命令: 开始时直接使用的sudo apt-get install wine 在运行 ...
- 如何在ubuntu下重建被grub覆盖的win10引导区?
如何在ubuntu下重建被grub覆盖的win10引导区? 1.修改grub配置文件: sudo vi /etc/default/grub 2.设置:GRUB_DEFAULT = 2 3.更新配置文件 ...
- Ubuntu下配置samba实现文件夹共享
转自:http://www.cnblogs.com/phinecos/archive/2009/06/06/1497717.html 一. samba的安装: sudo apt-get insall ...
- Ubuntu下配置Samba服务器
每次配置Samba 都需要上网去查资料,而且有一些不一定适合.所以自己就简单记录一下 1.Samba的安装 sudo apt-get insall samba // (sudo get temp ro ...
- Ubuntu下配置samba服务器实现文件共享
安装Samba 安装samba sudo apt-get install samba Kubuntu 安装系统设置的共享模块 sudo apt-get install kdenetwork-files ...
- 【转】Ubuntu下配置samba服务器--不错
原文网址:http://my.oschina.net/junn/blog/171388 设置虚拟机的网络方式为桥接方式: 一. samba的安装: sudo apt-get insall samba ...
- Ubuntu下的Samba服务器配置
一. samba的安装: sudo apt-get insall samba 二. 创建共享目录: mkdir /home/phinecos/share sodu chmod 777 /home/ge ...
- 共享文件 Ubuntu下安装Samba与Windows
Author:Xianghai Ding.Date:2019/01/08**************************************************************安装 ...
随机推荐
- 严谨的程序案例Api
文档 功能 同步推荐关系 接口方法 syncRelation 参数描述 OriginalUsername 查询的用户用户名 RecommandUsername 推荐人用户名 返回值 status 1成 ...
- 微信小程序之if操作
.wxss控制样式 .price-agent{ font-size: 25rpx; color:#ababab; float: left; position: absolute; bottom: 0; ...
- VS2012编译Lua5.3.1
编译静态库: 1.新建Win32控制台应用程序Lua5.3,下一步,应用程序类型选择:DLL,空项目,完成. 2.项目名右键属性,配置属性--项目默认值--配置类型:静态库(.lib) 3.头文件上右 ...
- jQuery中获取相对文档的坐标的方法是什么?
offset(),获取匹配元素在当前视口的相对偏移.返回的对象包含两个整型属性:top 和 left,以像素计.此方法只对可见元素有效. position()获取匹配元素相对定位父级的偏移.没有定位父 ...
- Oracle T4-2用jumpstart方式安装Solaris10
在安装过程中遇到了2个问题 1) 安装时无法识别硬RAID磁盘 T4-2的2块本地盘做了硬RAID,用jumpstart安装时无法识别硬RAID磁盘,报错信息如下: {0} ok boot net - ...
- Visual Studio 2005 C# 读写Excel文件
做作业的时候查了一点儿资料, 用的vs2k5 读 excel 发现用起来非常简单...现在编程语言没话说! 项目-添加引用-COM-Microsoft Excel 12.0 Object Librar ...
- leetcode378
public class Solution { public int KthSmallest(int[,] matrix, int k) { ); ); var list = new List< ...
- 解决The JSP specification requires that an attribute name is preceded by whitespace问题
笔者今天调试界面出现下边这个问题: The JSP specification requires that an attribute name is preceded by whitespace 经查 ...
- c# 程序调用cmd执行命令如SVN.exe
c# 程序调用cmd执行命令如SVN.exe string str = Console.ReadLine(); System.Diagnostics.Process p = new System.Di ...
- web服务器推送技术
传统模式的 Web 系统以客户端发出请求.服务器端响应的方式工作.不能满足很多现实应用的需求,譬如: 监控系统:后台硬件温度.电压发生变化: 即时通信系统:其它用户登录.发送信息: 即时报价系统:后台 ...