美文网首页
samba 配置

samba 配置

作者: 踌躇月光 | 来源:发表于2018-01-10 20:32 被阅读0次

安装 samba

pacman -S samba

配置文件位置

/etc/samba/smb.conf

共享 /tmp 目录

修改配置文件 /etc/samba/smb.conf 其中 username 是你自己的用户名

[global]

    workgroup = WORKGROUP
    server string = Samba Server
    log file = /var/log/samba/%m.log
    max log size = 50
    security = user
    unix extensions = no  
    follow symlinks = Yes
    wide links = Yes

[tmp]

    path = /tmp
    public = yes
    writable = yes
    printable = no
    create mask = 0765 
    browseable = yes
    available = yes
    valid users = username

添加用户

其中 username 为你自己的用户名

smbpasswd -a username

验证配置

testparm -s

输出结果

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[tmp]"
Loaded services file OK.
Server role: ROLE_STANDALONE

启动samba服务

sudo systemctl start smb nmb

重启samba服务

sudo systemctl restart smb nmb

设置开机启动

sudo systemctl enable smb nmb

Windows 直接访问

在Explorer地址栏中输入 //192.168.xxx.xxx,其中 192.168.xxx.xxx 为 Linux IP地址,可以使用 ifconfig 命令查看

credentials.jpg

输入用户名和密码之后,就可以看到 /tmp 目录了

tmp.jpg

Windows 映射网络磁盘

直接访问的方式有一种缺陷,就是无法在 cmd 命令行窗口中访问,这时可以将某个共享目录映射出网络磁盘。
在计算机中 计算机选项卡下,点击 Map network drive

Map network drive.jpg

输入目录地址,点击完成就可以了,如果想要一直显示该目录,可以勾选 Reconnect at sign-in

Map Network Drive.jpg

然后计算机中就多出了一个网络磁盘

Network Drive.jpg

这时就可以在cmd控制台中正常访问了,如果不想用了,可以点击右键 > Disconnect

访问软连接

在 [global] 最后加入下面几行

unix extensions = no  
follow symlinks = Yes
wide links = Yes

相关文章

网友评论

      本文标题:samba 配置

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