快速简单的创建共享,比网上那些乱七八糟过时的文档强太多

原文地址:
https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!

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').

  1. Install Samba
    1. sudo apt-get update
    2. sudo apt-get install samba
  2. Set a password for your user in Samba
    1. sudo smbpasswd -a <user_name>
      1. 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=

  3. Create a directory to be shared

    mkdir /home/<user_name>/<folder_name>

  4. 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 ~

  5. Edit the file "/etc/samba/smb.conf"

    sudo nano /etc/samba/smb.conf

    1. Once "smb.conf" has loaded, add this to the very end of the file:
    2.  
    3. [<folder_name>]
    4. path = /home/<user_name>/<folder_name>
    5. available = yes
    6. valid users = <user_name>
    7. read only = no
    8. browseable = yes
    9. public = yes
    10. 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.

  6. Restart the samba:

    sudo service smbd restart

  7. Once Samba has restarted, use this command to check your smb.conf for any syntax errors

    testparm

  8. 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".

    1. Note: The default user group of samba is "WORKGROUP".

Source

如何在ubuntu下使用samba创建共享的更多相关文章

  1. Ubuntu下添加Samba用户名与密码

    参考: ubuntu下的Samba配置:使每个用户可以用自己的用户名和密码登录自己的home目录 增加samba用户提示Failed to add entry for user Ubuntu可以直接在 ...

  2. 如何在ubuntu下使用windows下的程序(eg: .exe)

    为了在ubutu下安装百度云管家,上网查了下如何在ubuntu 下安装.exe文件,其中遇到一些问题记录如下: 使用的命令: 开始时直接使用的sudo apt-get install wine 在运行 ...

  3. 如何在ubuntu下重建被grub覆盖的win10引导区?

    如何在ubuntu下重建被grub覆盖的win10引导区? 1.修改grub配置文件: sudo vi /etc/default/grub 2.设置:GRUB_DEFAULT = 2 3.更新配置文件 ...

  4. Ubuntu下配置samba实现文件夹共享

    转自:http://www.cnblogs.com/phinecos/archive/2009/06/06/1497717.html 一. samba的安装: sudo apt-get insall  ...

  5. Ubuntu下配置Samba服务器

    每次配置Samba 都需要上网去查资料,而且有一些不一定适合.所以自己就简单记录一下 1.Samba的安装 sudo apt-get insall samba // (sudo get temp ro ...

  6. Ubuntu下配置samba服务器实现文件共享

    安装Samba 安装samba sudo apt-get install samba Kubuntu 安装系统设置的共享模块 sudo apt-get install kdenetwork-files ...

  7. 【转】Ubuntu下配置samba服务器--不错

    原文网址:http://my.oschina.net/junn/blog/171388 设置虚拟机的网络方式为桥接方式: 一. samba的安装: sudo apt-get insall samba  ...

  8. Ubuntu下的Samba服务器配置

    一. samba的安装: sudo apt-get insall samba 二. 创建共享目录: mkdir /home/phinecos/share sodu chmod 777 /home/ge ...

  9. 共享文件 Ubuntu下安装Samba与Windows

    Author:Xianghai Ding.Date:2019/01/08**************************************************************安装 ...

随机推荐

  1. telnet WIN7设置回显办法

    windows 2000及XP默认是关闭telnet回显的,这样在操作上很不方便,要让Telnet程序实现本地回显可以按如下步骤操作:1.在命令窗口中运行不带任何参数的telnet命令,执行 /hel ...

  2. java调用python

    本文记录下使用jython包来实现java代码中调用Python. 一.Maven加入 <dependency> <groupId>org.python</groupId ...

  3. web新特性 之 WebSocket

    详情参见:你真的了解WebSocket吗?     WebSocket系列教程   HTML5新特性之WebSocket WebSocket协议是基于TCP的一种新的协议.WebSocket最初在HT ...

  4. Python之购物商场

    作业:购物商场 1.流程图 2.初始化用户账号存储文件 初始化存储一个空的用户账号字典,保存到文件 user.pkl.执行如下代码,即可初始化完成. #!/usr/bin/env python # - ...

  5. left join的多重串联与groupby

    有三张表或组合查询,f1,f2,f3,其中,f1分别与f2,f3是一对多关系,f1一条记录可能对应f2或f3中0条或多条记录 要创建一个查询,以f1为基准,即f1中有多少条记录,结果也就返回对应数量的 ...

  6. 手机自带输入法emoji表情的输入,提交及显示——前端解决方案

    体验更优排版请移步原文:http://blog.kwin.wang/programming/emoji-transform-commit.html 之前就遇到过需要前端支持用户输入并提交emoji表情 ...

  7. Mysql问题随记

    [用户创建并授权远程访问] CREATE USER 'username'@'host' IDENTIFIED BY 'password’;   @后面跟主机地址,即这个用户可以从哪些地址访问数据库,l ...

  8. Hadoop Serialization(third edition)hadoop序列化详解(最新版) (1)

    初学java的人肯定对java序列化记忆犹新.最开始很多人并不会一下子理解序列化的意义所在.这样子是因为很多人还是对java最底层的特性不是特别理解,当你经验丰富,对java理解更加深刻之后,你就会发 ...

  9. sendClond如何更新邮件模板

    $url = 'http://www.sendcloud.net/webapi/template.update.json'; $API_USER = ''; $API_KEY = ''; $conte ...

  10. 分布式全文检索系统SolrCloud简介

    前言 本文简单描述SolrCloud的特性,基本结构和入门,基于Solr4.5版本. Lucene是一个Java语言编写的利用倒排原理实现的文本检索类库.Solr是以Lucene为基础实现的文本检索应 ...