最近总是在搭建 samba 环境,写在笔记上记录下以备后用,长时间不操作了肯定会忘记。
Linux 版本:Ubuntu 18.04
具体的操作命令:
1. 安装:
sudo apt-get install samba
2. 修改配置文件:
sudo vim /etc/samba/smb.conf
3. 具体修改内容如下:
[samba]
comment = Users profiles
path = "共享路径,如: /home"
guest ok = no
browseable = yes
writable = yes
create mask = 0766
directory mask = 0766
#[printers]
# comment = All Printers
# browseable = no
# path = /var/spool/samba
# printable = yes
# guest ok = no
# read only = yes
# create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
#[print$]
# comment = Printer Drivers
# path = /var/lib/samba/printers
# browseable = yes
# read only = yes
# guest ok = no
4. 添加 samba 用户:
smbpasswd -a "用户名"
5. 重启 samba 服务器:
sudo /etc/init.d/smbd restart
至此,samba 服务器配置成功,在 windows 下即可以 \\samba IP 的形式进行访问,如在我的电脑的地址栏填入 \\192.168.125.128,随后进入到 samba 的共享目录,验证的帐号密码即如配置步骤 4 所设。