【Linux系统】Centos7系统下配置samba共享

简介: 【Linux系统】Centos7系统下配置samba共享

一、Samba服务介绍

Samba是一套使用SMB(Server Message Block)协议的应用程序, 通过支持这个协议, Samba允许Linux服务器与Windows系统之间进行通信,使跨平台的互访成为可能。Samba采用C/S模式, 其工作机制是让NetBIOS( Windows 网上邻居的通信协议)和SMB两个协议运行于TCP/IP通信协议之上,并且用NetBEUI协议让Windows在“网上邻居”中能浏览Linux服务器。

二、配置yum仓库

1.配置阿里云的yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2.检查yum仓库状态

[root@server ~]# yum repolist all
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                                                   repo name                                                                                      status
C7.0.1406-base/x86_64                                                     CentOS-7.0.1406 - Base                                                                         disabled
C7.0.1406-centosplus/x86_64                                               CentOS-7.0.1406 - CentOSPlus                                                                   disabled
C7.0.1406-extras/x86_64                                                   CentOS-7.0.1406 - Extras                                                                       disabled
C7.0.1406-fasttrack/x86_64                                                CentOS-7.0.1406 - Fasttrack                                                                    disabled
C7.0.1406-updates/x86_64                                                  CentOS-7.0.1406 - Updates                                                                      disabled
C7.1.1503-base/x86_64                                                     CentOS-7.1.1503 - Base                                                                         disabled
C7.1.1503-centosplus/x86_64                                               CentOS-7.1.1503 - CentOSPlus                                                                   disabled
C7.1.1503-extras/x86_64                                                   CentOS-7.1.1503 - Extras                                                                       disabled
C7.1.1503-fasttrack/x86_64                                                CentOS-7.1.1503 - Fasttrack                                                                    disabled
C7.1.1503-updates/x86_64                                                  CentOS-7.1.1503 - Updates                                                                      disabled
C7.2.1511-base/x86_64                                                     CentOS-7.2.1511 - Base                                                                         disabled
C7.2.1511-centosplus/x86_64                                               CentOS-7.2.1511 - CentOSPlus                                                                   disabled
C7.2.1511-extras/x86_64                                                   CentOS-7.2.1511 - Extras                                                                       disabled
C7.2.1511-fasttrack/x86_64                                                CentOS-7.2.1511 - Fasttrack                                                                    disabled
C7.2.1511-updates/x86_64                                                  CentOS-7.2.1511 - Updates                                                                      disabled
C7.3.1611-base/x86_64                                                     CentOS-7.3.1611 - Base                                                                         disabled
C7.3.1611-centosplus/x86_64                                               CentOS-7.3.1611 - CentOSPlus                                                                   disabled
C7.3.1611-extras/x86_64                                                   CentOS-7.3.1611 - Extras                                                                       disabled
C7.3.1611-fasttrack/x86_64                                                CentOS-7.3.1611 - Fasttrack                                                                    disabled
C7.3.1611-updates/x86_64                                                  CentOS-7.3.1611 - Updates                                                                      disabled
C7.4.1708-base/x86_64                                                     CentOS-7.4.1708 - Base                                                                         disabled
C7.4.1708-centosplus/x86_64                                               CentOS-7.4.1708 - CentOSPlus                                                                   disabled
C7.4.1708-extras/x86_64                                                   CentOS-7.4.1708 - Extras                                                                       disabled
C7.4.1708-fasttrack/x86_64                                                CentOS-7.4.1708 - Fasttrack                                                                    disabled
C7.4.1708-updates/x86_64                                                  CentOS-7.4.1708 - Updates                                                                      disabled
C7.5.1804-base/x86_64                                                     CentOS-7.5.1804 - Base                                                                         disabled
C7.5.1804-centosplus/x86_64                                               CentOS-7.5.1804 - CentOSPlus                                                                   disabled
C7.5.1804-extras/x86_64                                                   CentOS-7.5.1804 - Extras                                                                       disabled
C7.5.1804-fasttrack/x86_64                                                CentOS-7.5.1804 - Fasttrack                                                                    disabled
C7.5.1804-updates/x86_64                                                  CentOS-7.5.1804 - Updates                                                                      disabled
!appnode/x86_64                                                           AppNode's RPM repository for Enterprise Linux 7 - x86_64                                       enabled:  4,266
!appnode-agent/x86_64                                                     AppNode Agent Repository - x86_64                                                              enabled:    332
appnode-agent-archive/x86_64                                              AppNode Agent Repository - x86_64                                                              disabled
appnode-agent-development/x86_64                                          AppNode Agent Repository - x86_64                                                              disabled
appnode-archive/x86_64                                                    AppNode's RPM repository for Enterprise Linux 7 - x86_64                                       disabled
!appnode-ccenter/x86_64                                                   AppNode CCenter Repository - x86_64                                                            enabled:     71
appnode-ccenter-archive/x86_64                                            AppNode CCenter Repository - x86_64                                                            disabled
appnode-ccenter-development/x86_64                                        AppNode CCenter Repository - x86_64                                                            disabled
appnode-development/x86_64                                                AppNode's RPM repository for Enterprise Linux 7 - x86_64                                       disabled
!appnode-extras/x86_64                                                    AppNode Extras Repository - x86_64                                                             enabled:     88
appnode-extras-archive/x86_64                                             AppNode Extras Repository - x86_64                                                             disabled
appnode-extras-development/x86_64                                         AppNode Extras Repository - x86_64                                                             disabled
!base/7/x86_64                                                            CentOS-7 - Base - mirrors.aliyun.com                                                           enabled: 10,072
base-debuginfo/x86_64                                                     CentOS-7 - Debuginfo                                                                           disabled
base-source/7                                                             CentOS-7 - Base Sources                                                                        disabled
c7-media                                                                  CentOS-7 - Media                                                                               disabled
centosplus/7/x86_64                                                       CentOS-7 - Plus - mirrors.aliyun.com                                                           disabled
centosplus-source/7                                                       CentOS-7 - Plus Sources                                                                        disabled
contrib/7/x86_64                                                          CentOS-7 - Contrib - mirrors.aliyun.com                                                        disabled
cr/7/x86_64                                                               CentOS-7 - cr                                                                                  disabled
docker-ce-nightly/7/x86_64                                                Docker CE Nightly - x86_64                                                                     disabled
docker-ce-nightly-debuginfo/7/x86_64                                      Docker CE Nightly - Debuginfo x86_64                                                           disabled
docker-ce-nightly-source/7                                                Docker CE Nightly - Sources                                                                    disabled
!docker-ce-stable/7/x86_64                                                Docker CE Stable - x86_64                                                                      enabled:    163
docker-ce-stable-debuginfo/7/x86_64                                       Docker CE Stable - Debuginfo x86_64                                                            disabled
docker-ce-stable-source/7                                                 Docker CE Stable - Sources                                                                     disabled
docker-ce-test/7/x86_64                                                   Docker CE Test - x86_64                                                                        disabled
docker-ce-test-debuginfo/7/x86_64                                         Docker CE Test - Debuginfo x86_64                                                              disabled
docker-ce-test-source/7                                                   Docker CE Test - Sources                                                                       disabled
!epel/x86_64                                                              Extra Packages for Enterprise Linux 7 - x86_64                                                 enabled: 13,757
epel-debuginfo/x86_64                                                     Extra Packages for Enterprise Linux 7 - x86_64 - Debug                                         disabled
epel-source                                                               Extra Packages for Enterprise Linux 7 - x86_64 - Source                                        disabled
!extras/7/x86_64                                                          CentOS-7 - Extras - mirrors.aliyun.com                                                         enabled:    512
extras-source/7                                                           CentOS-7 - Extras Sources                                                                      disabled
fasttrack/7/x86_64                                                        CentOS-7 - fasttrack                                                                           disabled
!updates/7/x86_64                                                         CentOS-7 - Updates - mirrors.aliyun.com                                                        enabled:  4,050
updates-source/7                                                          CentOS-7 - Updates Sources                                                                     disabled

三、安装samba客户端

1.安装samba-client

yum install -y samba-client

2.查看共享状态

[root@server ~]# smbclient -L 192.168.3.100
Enter SAMBA\root's password: 
Anonymous login successful

    Sharename       Type      Comment
    ---------       ----      -------
    share           Disk      
    IPC$            IPC       IPC Service (Samba 4.5.16-Debian)
Reconnecting with SMB1 for workgroup listing.
Anonymous login successful

    Server               Comment
    ---------            -------

    Workgroup            Master
    ---------            -------

四、Linux配置samba服务器

Linux下的samba服务配置详解

家庭NAS搭建实战之samba共享

五、Linux挂载Samba

1.安装相关软件包

yum install  -y nfs-utils  cifs-utils 

2.创建挂载目录

mkdir -p /samba/data

3.挂载samba

mount -t cifs //192.168.3.100/data/NAS/nas /samba/data  -o username=admin,password=123123

3.查看挂载状态

[root@servert ~]# df -h |grep samba
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root     17G  1.2G   16G   7% /
 //192.168.3.100/data/NAS/nas  17G  1.2G   16G   7%  /samba/data
相关文章
|
9月前
|
Ubuntu Linux Anolis
Linux系统禁用swap
本文介绍了在新版本Linux系统(如Ubuntu 20.04+、CentOS Stream、openEuler等)中禁用swap的两种方法。传统通过注释/etc/fstab中swap行的方式已失效,现需使用systemd管理swap.target服务或在/etc/fstab中添加noauto参数实现禁用。方法1通过屏蔽swap.target适用于新版系统,方法2通过修改fstab挂载选项更通用,兼容所有系统。
823 3
Linux系统禁用swap
|
9月前
|
Linux
Linux系统修改网卡名为eth0、eth1
在Linux系统中,可通过修改GRUB配置和创建Udev规则或使用systemd链接文件,将网卡名改为`eth0`、`eth1`等传统命名方式,适用于多种发行版并支持多网卡配置。
1398 3
|
Ubuntu Linux 网络安全
Linux系统初始化脚本
一款支持Rocky、CentOS、Ubuntu、Debian、openEuler等主流Linux发行版的系统初始化Shell脚本,涵盖网络配置、主机名设置、镜像源更换、安全加固等多项功能,适配单/双网卡环境,支持UEFI引导,提供多版本下载与持续更新。
887 3
Linux系统初始化脚本
|
10月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
661 18
|
9月前
|
安全 Linux Shell
Linux系统提权方式全面总结:从基础到高级攻防技术
本文全面总结Linux系统提权技术,涵盖权限体系、配置错误、漏洞利用、密码攻击等方法,帮助安全研究人员掌握攻防技术,提升系统防护能力。
1046 1
|
9月前
|
监控 安全 Linux
Linux系统提权之计划任务(Cron Jobs)提权
在Linux系统中,计划任务(Cron Jobs)常用于定时执行脚本或命令。若配置不当,攻击者可利用其提权至root权限。常见漏洞包括可写的Cron脚本、目录、通配符注入及PATH变量劫持。攻击者通过修改脚本、创建恶意任务或注入命令实现提权。系统管理员应遵循最小权限原则、使用绝对路径、避免通配符、设置安全PATH并定期审计,以防范此类攻击。
1352 1
|
10月前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
2511 10
|
Linux 网络安全 数据安全/隐私保护
如何在 CentOS 上安装和配置 Samba?
如何在 CentOS 上安装和配置 Samba?
2054 0
如何在 CentOS 上安装和配置 Samba?
|
开发工具 数据安全/隐私保护
Centos6.5安装并配置samba服务
配置Samba服务,执行`yum -y install samba`。创建finance、sales、manager组及对应用户:user1, user2(finance组),user3(sales组),manager(manager组)。设定用户密码。创建共享目录,给予finance组对finance目录的读写权限,编辑`smb.conf`。manager拥有所有共享目录的读写权限。确保用户对其共享文件夹有完全权限,其他用户只读写。重启服务。共享/opt/public_share为share,创建无登陆权用户Tonny,允许所有用户读写,文件属主为Tonny。最后,重启服务。
365 0
|
Linux 网络安全 数据安全/隐私保护
linux篇-centos7安装samba服务器
linux篇-centos7安装samba服务器
402 0
linux篇-centos7安装samba服务器

热门文章

最新文章