Samba常用配置及匿名用户访问

    xiaoxiao2023-03-24  4

    0. 主机环境

    root@ubuntu:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS Release: 14.04 Codename: trusty

    1. Samba软件包的安装

    使用源安装,在终端中输入如下命令:

    #sudo apt-get install samba root@ubuntu:~# samba -V Version 4.3.9-Ubuntu

    2. 配置Samba服务

    Samba服务器主要配置文件为/etc/samba/smb.conf,并且可以将NetBIOS名与主机的对应关系写在/etc/samba /lmhosts文件中。

    (1)在Windows系统中不用输入密码访问Linux共享目录 在Linux共享一个目录,将建立好的目录的设置信息写入/etc/smb.conf文件即可。如:若共享/home/myth/share目录,要在 Windows系统中访问这个共享的目录,假设Windows主机的IP为192.168.0.11,Linux主机的IP为192.168.10,进行 如下操作:

    #mkdir /home/myth/share #sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak //修改配置文件之前最好做个备份 #vim /etc/samba/smb.conf

    或者使用 sudo gedit /etc/samba/smb.conf 打开配置文件 将文件中的内容做如下相应修改:

    #### Debugging/Accounting #### # share the dir without passwd security = user map to guest = Bad User # 在文件结尾添加如下行: [share] comment=this is Linux share directory path=/home/myth/share public=yes writable=yes

    保存退出,启动Samba服务:

    #/etc/init.d/samba start

    设置完成!

    在Windows 下访问共享目录,可点击运行,输入 \192.168.0.10\share 这样就能以匿名用户访问共享目录share了。

    关于Windows下无写权限:chmod -R go+rwx share/

    3. Samba服务器的启动、关闭和重启

    启动Samba服务器只需执行如下命令: #sudo /etc/init.d/samba start 关闭Samba服务器: #sudo /etc/init.d/samba stop 重新启动Samba服务器: #sudo /etc/init.d/samba restart
    转载请注明原文地址: https://ju.6miu.com/read-1201704.html
    最新回复(0)