如何在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**************************************************************安装 ...
随机推荐
- codeforce 985A Chess Placing(暴力)
Chess Placing time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- chrome浏览器手动添加印象笔记剪藏插件
标签(空格分隔): chrome浏览器,日常办公 一直为每次从网页上复制内容之后,还需要再去复制对应的网址,倍感麻烦.之前偶尔这样操作还可以,最近在学习新东西,要保留下来的网页实在太多,而且不利于分类 ...
- Thinkphp或查询使用
if ($_GET['machine_type_id']) { $machine_type_id = trim($_GET['machine_type_id']); $where['machine_t ...
- 360良心制作fonts.useso.com
我们的网站,经常会用到google的一些数据. 但在国内无法使用google, 360这个良心的企业,解决了这个问题. 把google替换成useso就可以了. 比如, <link href=& ...
- DoDataExchange函数,UpdateData(TRUE)和UpdateData(FALSE)的区别
MFC控件(暂时为Edit控件)与数据的绑定,变量值可以在界面和后台之间传递. 我们在DoDataExchange(CDataExchange* pDX) 函数里,实现了MFC控件和变量的绑定. 若 ...
- Python IO 多路复用 \协程
IO 多路复用 作用: 检测多个socket是否已经发生变化(是否已经连接成功/是否已经获取数据) 即(可读/可写) IO请求时 解决并发 : 单线程 def get_data(key): cl ...
- leetcode762
class Solution { public: bool IsPrime(int n) { ) { return false; } || n == ) { return true; } ; i &l ...
- SSH免密登陆配置过程和原理解析
SSH免密登陆配置过程和原理解析 SSH免密登陆配置过很多次,但是对它的认识只限于配置,对它认证的过程和基本的原理并没有什么认识,最近又看了一下,这里对学习的结果进行记录. 提纲: 1.SSH免密登陆 ...
- json和pickle序列化模块
一.json序列化模块 1.序列化:将内存数据转成字符串加以保存. 2.反序列化:将字符串转成内存数据加以读取. data = { '北京':{ '五道口':{ 'sohu':'引擎', } } } ...
- Objects & Class
[Objects & Class] 1.定义一个类. 上述代码中,numberOfSides是实例变量,simpleDescription也是实例方法. 2.创建实例,使用实例. 3.init ...