如何在ubuntu下使用samba创建共享

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

原文地址:
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

  1. http://www.hardcode.nl/archives_147/article_548-samba-quick-setup-on-ubuntu-1004.htm
时间: 2024-08-28 21:15:05

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

如何在Ubuntu 下 重装Tomcat

今天尝试在ubuntu下搭建tomcat,因为某些事情 中途删掉了,后来想重装居然出现了 chmod: cannot access `/etc/tomcat7/tomcat-users.xml': No such file or directory 导致无法正常安装,后来google 了一下,发现了解决办法.原帖:http://askubuntu.com/questions/228888/installing-tomcat-7-using-apt-get-fails 其实就是在通过 自带apt-

[编程菜谱]如何在Ubuntu下编译链接最简单的curl例子

简介:有点时间没有在Linux环境下战斗了,刚好需要研究一下curl的API使用,试图编译链接了一个最简单的curl例子,发现了很多问题,最后决定把过程记录下来,以防止未来再犯类似的简单错误,如果能帮助到某位过客,也算是幸事! 食材: Ubuntu 12.04 64-bit 安装了基本的gcc.g++.make,恕不赘述 simple.c 一个最最简单的官网curl的c实例,万丈高楼平地起嘛 步骤: 1. 首先要安装curl的开发环境 sudo apt-get install libcurl4-

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

转自:http://www.cnblogs.com/phinecos/archive/2009/06/06/1497717.html 一. samba的安装: sudo apt-get insall sambasudo apt-get install smbfs 二. 创建共享目录: mkdir /home/phinecos/sharesodu chmod 777 /home/phinecos/share 三. 创建Samba配置文件: 1. 保存现有的配置文件 sudo cp /etc/sam

在Ubuntu下开启Samba于windows共享

系统版本:Ubuntu 14.04 1.安装Samba服务 sudo apt-get install samba samba-common 测试是否启动正常 /etc/init.d/smbd start 2.创建共享用户和共享目录 smbpasswd -a haha 查看用户详细信息 pdbedit  -Lv pdbedit –a username:新建Samba账户. pdbedit –x username:删除Samba账户. pdbedit –L:列出Samba用户列表,读取passdb.

Ubuntu下配置samba服务器

一.samba的安装: sudo apt-get insall samba // (sudo get temp root auth) sudo apt-get install smbfs二. 创建共享目录: mkdir /home/john/share sudochmod 777 /home/john/share 说明:john为你的ubuntu的用户名 share你可以随便起个名字做为共享文件夹三.创建Samba配置文件:1. 保存现有的配置文件sudo cp /etc/samba/smb.c

Ubuntu下的Samba服务器配置

一. samba的安装: sudo apt-get insall samba 二. 创建共享目录: mkdir /home/phinecos/sharesodu chmod 777 /home/gec/share 三. 创建Samba配置文件: 1. 保存现有的配置文件 sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2. 修改现配置文件 sudo gedit /etc/samba/smb.conf 在smb.conf最后添加 [share

【转】Ubuntu下配置samba服务器

原文网址:http://my.oschina.net/junn/blog/171388 一. samba的安装: sudo apt-get insall samba      // (sudo get temp root auth) sudo apt-get install smbfs     //旧版本 sudo apt-get install cifs-utils //新版本 上面的命令将会安装Samba和其他相关的工具.在旧版的Ubuntu中,你可能需要使用 smbfs替代 cifs-ut

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

安装Samba 安装samba sudo apt-get install samba Kubuntu 安装系统设置的共享模块 sudo apt-get install kdenetwork-filesharing 配置 1.windows 访问 ubuntu 第一步创建共享目录:比如要创建/home/用户名/share首先创建这个文件夹(这个用户名就是你的用户名,为了方便易懂我才这样写的,到时记得自己改啊) 代码: mkdir /home/用户名/share (新建share文件夹) chmod

如何在Ubuntu 16.04中创建GIF动图

导读 FFmpeg 是一款开源的音.视转换器,使用 FFmpeg 我们可以非常容易地转换和录制音视频文件,而 ImageMagick 是一款用于创建.编辑和合并位图图像的一款开源软件. 大家经常在新浪微薄.QQ.facebook.twitter 中看到有趣的 GIF 动图吧,GIF 文件比视频小.比静态 JPG 图片形像生动,非常适于互联网上的搞笑帖子.产品展示和功能步骤演示,所以此小教程将教大家如何在 Ubuntu 16.04 LTS 桌面系统中制作.转换 GIF 效果图片.其实并不难,只需一