加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

redhat如何安装配置samba实现win共享linux主机目录

发布时间:2016-10-11 15:13:46 所属栏目:Linux 来源:网络整理
导读:redhat安装配置samba实现win共享linux主机目录 一、安装前准备 1、使用Samba服务器需要防火墙开放以下端口 UDP 137 UDP 138 TCP 139 TCP 445 #配置防火墙端口 w

#在配置文件的末尾添加以下自定义内容

[SambaServer]                      #在Windows网上邻居中看到的共享目录的名字

comment = SambaServer          #在Windows网上邻居中看到的共享目录的备注信息

path = /home/SambaServer       #共享目录在系统中的位置

public = no                    #不公开目录

writable = yes                 #共享目录可以读写

valid users=SambaServer        #只允许SambaServer用户访问

#保存配置

3、添加访问linux共享目录的账号SambaServer

用户家目录为/home/SambaServer, 用户登录终端设为/bin/false(即使之不能登录系统)

[root@roothomes ~] mkdir -p /home/SambaServer #建立SambaServer文件夹

[root@roothomes ~] cd /home/SambaServer

[root@roothomes ~] touch  samba.txt   #创建测试文件samba.txt

[root@roothomes ~] useradd SambaServer -d /home/SambaServer -s /bin/false

[root@roothomes ~] chown SambaServer:SambaServer /home/SambaServer -R

4、将用户SambaServer添加入到Samba用户数据库,并设置登录共享目录的密码为:123456

[root@roothomes ~] smbpasswd -a SambaServer

New SMB password:  输入该用户用于登录Samba的密码

Retype new SMB password:  再次确认输入该密码

Added user SambaServer.

#备注:这里设置的密码是SambaServer用户登录该机的Samba共享的密码,非登陆OS的密码;

5、重启Samba服务器

[root@roothomes ~] /etc/init.d/smb restart

6、浏览共享信息

在Windows客户端输入 ip  或者 SambaServer  #服务器别名

回车之后,会跳出来登录框,输入账号SambaServer ,密码123456 , 即可访问共享目录

问题:

如果无法访问共享目录的内容,请把防火墙停止;

[root@roothomes ~] service iptables stop

本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读