centOS6.8 Samba服务 安装配置(客户端无用户访问)

    xiaoxiao2021-03-25  108

    1.开启samba服务端口  # vi /etc/sysconfig/iptables -A INPUT -p tcp --dport 137 -j ACCEPT -A INPUT -p udp --dport 137 -j ACCEPT -A INPUT -p tcp --dport 138 -j ACCEPT -A INPUT -p udp --dport 138 -j ACCEPT -A INPUT -p tcp --dport 139 -j ACCEPT -A INPUT -p udp --dport 139 -j ACCEPT -A INPUT -p tcp --dport 445 -j ACCEPT -A INPUT -p udp --dport 445 -j ACCEPT # service iptables restart Or 粗暴点直接关闭iptables   # chkconfig iptables off 2.修改selinux # setenforce 0      临时关闭 重启后无效 Or 直接修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled 重启机器即可 3.安装 samba # yum -y install samba 4.启动以及相关命令 # /etc/init.d/smb start/stop/restart # /etc/init.d/nmb start/stop/restart # service smb status # chkconfig --level 35 smb on                                 在3、5级别上自动运行 5**.配置smb.conf # vi /etc/samba/smb.conf # ----------------------- Standalone Server Options ------------------------ # # Scurity can be set to user, share(deprecated) or server(deprecated)         security = share                                  //共享级别,用户不需要账号和密码即可访问 #=======================Share  Definitions====================== [public]                                          //设置针对的是共享目录个别的设置,只对当前的共享资源起作用         comment = Public Stuff        //对共享目录的说明文件,自己可以定义说明信息         path = /home/samba            //用来指定共享的目录,必选项         public = yes                           //所有人可查看,等效于guest ok = yes 配完后保存退出  手动建立对应的共享文件夹 # mkdir /home/samba # cd /home/samba                到目录下创建测试文件 # touch aa.txt              # touch bb.txt # chomn -R nobody:nobady /home/samba   *注意要把 [public] 前的注释去掉 *具体samba配置文件的详解参考 http://www.cnblogs.com/mchina/archive/2012/12/18/2816717.html 6.客户端登录 linux登录: # smbclient //192.168.1.120/public (-U为用户名,这里是无用户登录,就可以不用加) windows登录: 在cmd中输入  \\192.168.1.120\public *过程中遇到的问题 : 1.配置文件中的 [public] 一栏 的注释没有去掉 2.登录时报错: Server requested LANMAN password (share-level security) but 'client lanman auth = no' or 'client ntlmv2 auth = yes' tree connect failed: NT_STATUS_ACCESS_DENIED 解决方法:在smb.conf里的 [global] 下添加配置   client lanman auth = Yes lanman auth = Yes client ntlmv2 auth = no 然后重启smb服务 # service smb restart 具体参考 http://www.linuxidc.com/Linux/2013-10/90935p2.htm
    转载请注明原文地址: https://ju.6miu.com/read-18625.html

    最新回复(0)