美文网首页
安装Samba共享文件

安装Samba共享文件

作者: Lin_haobin | 来源:发表于2017-12-30 20:06 被阅读0次

Samba服务工作原理

Samba服务功能强大,这与通信是基于SMB协议有大的有关系。SMB协议不仅能够提供目录和共享打印机,还支持认证和权限

设置等功能。在早期。SMB运行于NBT协议上,使用UDP协议的137、138及TCP协议的139端口,但随着后期开发,它可以直接

运行于TCP/IP协议上,没有额外的NBT层,使用TCP协议的445端口。

通过Samba服务,Windows用户可以通过[网上邻居]窗口查看到Linux服务器中的共享的资源,同时Linux用户也能够查看到

服务器上的共享资源。

服务器端配置

安装samba服务

[root@classroom ~]# yum -y install samba

临时关闭selinux

[root@classroom ~]# setenforce 0

关闭防火墙

[root@classroom ~]# systemctl stop firewalld

[root@classroom ~]# systemctl stop iptables

添加共享目录及修改目录权限

[root@classroom ~]# mkdir /common

[root@classroom ~]# chmod 777 /common

[root@classroom ~]# echo "hello the word " > /common/smb.txt

编辑samba主配置文件

[root@classroom ~]# vim /etc/samba/smb.conf

添加下面内容

[common]

commonent=Common share

path = /common

browseable = yes

guest ok = no

writable = yes

创建samba用户

[root@classroom ~]# useradd -s /sbin/nologin smbuser

[root@classroom ~]# smbpasswd -a smbuser

重启下samba服务

[root@classroom ~]# systemctl restart smb

客户端配置

windows环境访问

按win+R快捷键开启运行对话,输入\\IP(IP为samba服务器的IP地址)

Linux环境访问

安装samba客户端

[root@server0 ~]# yum -y install samba-client

访问samba

[root@server0 ~]# smbclient -U smbuser //172.25.0.254/common

相关文章

网友评论

      本文标题:安装Samba共享文件

      本文链接:https://www.haomeiwen.com/subject/geengxtx.html