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

简介: 快速简单的创建共享,比网上那些乱七八糟过时的文档强太多 原文地址: https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Com...

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

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

目录
相关文章
|
6月前
|
安全 Ubuntu
Ubuntu Samba高危安全漏洞修复
Ubuntu系统中使用的Samba版本存在一个或多个高风险安全漏洞。受影响的Samba版本包括但不限于4.13.x低于4.13.17、4.14.x低于4.14.12以及4.15.x低于4.15.5。这些漏洞可能会允许未经身份验证的攻击者远程执行恶意代码,获取未经授权的访问权限,或者进行其他形式的安全攻击。
204 0
|
1月前
|
Ubuntu Linux Windows
Ubuntu 14.04安装samba服务器
Ubuntu 14.04安装samba服务器
22 0
|
3月前
|
Ubuntu 安全 测试技术
Ubuntu 22.04 Samba 安装和配置
SMB(Server Message Block)是一种跨平台的文件共享协议,它允许不同操作系统之间的文件和打印机共享。在本文中,我们将详细介绍如何在 Ubuntu 服务器上部署和配置一个 SMB 服务器,并涵盖多通道配置、性能测试、安全最佳实践以及一些常见问题。【8月更文挑战第1天】
566 1
|
6月前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
6月前
|
Ubuntu 安全 数据安全/隐私保护
百度搜索:蓝易云【Ubuntu配置Samba服务教程】
现在,你已经成功在Ubuntu上配置了Samba服务。其他计算机可以通过网络访问你共享的文件夹。在访问时,需要输入Samba用户的用户名和密码。注意,为了安全起见,建议配置Samba的访问权限和加密选项。
96 1
|
6月前
|
Ubuntu Linux Windows
window10 虚拟机 linux ubuntu 环境下samba服务器配置
本文的目的是在windows 10 系统,使用samba服务实现 windows 10共享虚拟机ubuntu系统的文件。
136 0
|
11月前
|
Ubuntu Linux 数据安全/隐私保护
Ubuntu系统配置Samba实现与Windows系统的文件共享
Ubuntu系统配置Samba实现与Windows系统的文件共享
212 0
|
Ubuntu Linux 开发工具
Ubuntu2021.4 samba服务器配置方案[开源]
Ubuntu2021.4 samba服务器配置方案[开源]
135 3
|
Ubuntu Linux 开发工具
Ubuntu与window实现文件共享——Samba使用
Ubuntu与window实现文件共享——Samba使用
236 0
|
Ubuntu Linux 数据安全/隐私保护
UBUNTU配置samba
UBUNTU配置samba
128 0