如何在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**************************************************************安装 ...
随机推荐
- mybatis~SQL映射
student.xml里面是这么写的: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE m ...
- 16c550芯片编写的优化
参考了 <Altera FPGA/CPLD 设计>高级篇, 关于状态机的推荐写法实现的功能是一样的但是编译使用的逻辑门如下图: 下图是我自己编的状态机需要的逻辑: 下图是使用推荐的有限状态 ...
- 第十五章 MySQL日志(待续)
·······
- Python中常用模块一
random模块 import random # 应用数学计算 print(random.random()) # 取随机小数 范围是 0-1之间 # 应用抽奖 , 彩票 print(random.ra ...
- SEO网站title应该怎么写
第一:具有独特性 在你的网站中,也许有成千上万的页面,首页-分类-无数的文章页面,这些都有固定的标题,他们的标题最好不要相同.有的时候也许不是`站长们故意的,但是在使用编辑软件的时候,经常 会出现很多 ...
- MySQL中SQL_CALC_FOUND_ROWS的用法
1. SQL_CALC_FOUND_ROWS简述 在很多分页的程序中都这样写: #查出符合条件的记录总数 SELECT COUNT(*) from [table] WHERE ......; #查询当 ...
- Python 的mock模拟测试介绍
如何不靠耐心测试 可能我们正在写一个社交软件并且想测试一下"发布到Facebook的功能",但是我们不希望每次运行测试集的时候都发布到Facebook上. Python的unitt ...
- PHP使用mkdir创建多级目录的方法
PHP中使用mkdir()可以创建多级目录,相比之前自己一级一级的创建,这个函数非常好用. 下面是php手册上的函数介绍: bool mkdir ( string $pathname [, int $ ...
- [转载]C语言 宏
当然宏定义非常重要的,它可以帮助我们防止出错,提高代码的可移植性和可读性等. 1,防止一个头文件被重复包含 #ifndef COMDEF_H#define COMDEF_H //头文件内容 …#end ...
- Yii 2 load() 和 save()
我这里用的数据库是mongo 数据库 为栗子: public function load($data, $formName = null) { $scope = $formName === null ...