【Linux系统】Centos7系统下配置samba共享
【摘要】 【Linux系统】Centos7系统下配置samba共享
@TOC
一、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
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
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)