如何在Ubuntu 20.04 LTS上安装Samba
admin
2023-08-01 11:07:33
0

samba-logosamba-logo在Ubuntu 20.04 LTS Focal Fossa上安装Samba

步骤1.首先,通过apt在终端中运行以下命令来确保所有系统软件包都是最新的。

sudo apt update
sudo apt upgrade

步骤2.配置主机文件。

我们需要将Ubuntu 20.04 LTS添加到Windows主机文件中。为此,请在Windows中运行以下命令:

notepad C:\\\\Windows\\System32\\drivers\\etc\\hosts

您需要添加由命名的ubuntu2004引用的Ubuntu的本地条目,并保存它:

192.168.1.3   ubuntu2004.localhost   ubuntu2004

然后,运行以下命令,并使用Windows的主机名键入IP,保存文件并退出:

sudo nano /etc/hosts

完成后,以管理特权在Windows中运行以下命令:

netsh advfirewall firewall set rule group=\"File and Printer Sharing\" new enable=Yes netsh advfirewall firewall set rule group=\"Network Discovery\" new enable=Yes

步骤3.在Ubuntu 20.04上安装Samba。

在终端中运行以下命令以在Ubuntu系统上安装Samba:

sudo apt install samba samba-common-bin

要验证Samba服务是否正在运行,请运行以下命令:

sudo systemctl status smbd

步骤4.配置Samba公共共享。

运行以下命令以打开Samba配置:

sudo nano /etc/samba/smb.conf

在下面添加以下行:

======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUPnetbios name = ubuntu2004
   security = user
   proxy = no
   map to guest = bad user
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# \'interfaces\' option above to use this.
bind interfaces only = yes

#Most people will want \"standalone server\" or \"member server\".
#Running as \"active directory domain controller\" will require firstserver role = standalone server
obey pam restrictions = yes
#This boolean parameter controls whether Samba attempts to sync the Unix[public]
   path = /samba/public
   browseable = yes
   guest ok = yes
   guest only = yes
   read only = no
   force user = nobody
   force create mode = 0777
   force directory mode = 0777

进行更改后,重新启动Samba守护程序:

sudo systemctl restart smbd

接下来,您需要创建一个公用文件夹,每个人都应具有以下权限:

sudo mkdir -p /samba/public

成功后,重新启动Samba服务器。您可以在Windows 10或您使用的任何Windows中看到共享文件夹。

步骤5.配置防火墙。

如果您有活动的防火墙,请运行:

sudo ufw allow \'Samba\'

恭喜你!您已经成功安装了Samba。感谢您使用本教程在Ubuntu 20.04 LTS Focal Fossa系统上安装Samba。有关其他帮助或有用信息,我们建议您检查Samba官方网站。

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
Hive OS 部署 PXE ... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何在电报Telegram中隐... 点击进入:ChatGPT工具插件导航大全 在Android上的电报中隐藏您的电话号码 您可以通过切换...
在 iCloud 上关闭“查找... 如果您是 Apple 的长期用户,您肯定会遇到过 Find My 应用程序,它本机安装在 iPhon...
farols1.1.501.0... faro ls 1.1.501.0(64bit)可以卸载,是一款无需连接外部PC机或笔记本计算机即可...
如何在Instagram上扫描... 如何在Instagram上扫描名称标签/ QR? 总而言之,您可以通过大约四种不同的方法来扫描这些I...