首先,如果您对现有 samba 配置进行了任何更改,请还原它们,或者删除/etc/samba/smb.con
并卸载 samba。
我假设您的 Ubuntu 服务器用户名是peterlustig
Ubuntu 服务器 IP 是192.168.2.42
.
sudo apt-get install samba
sudo cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak
只需备份您的配置sudo mkdir /myshares
- 您想通过 Samba 分享的内容sudo chown peterlustig:peterlustig /myshares
sudo chmod 777 /myshares
或尝试较低的权限,我还没有这样做sudo smbpasswd -a peterlustig
将用户 peterlustig 添加到 Samba 数据库并激活它。(通常与 Ubuntu 本身中的 peterlustig 密码不同。密码是您稍后与 Windows 10 客户端连接到服务器时需要输入的密码,步骤 10)sudo nano /etc/samba/smb.conf
并将以下内容添加到文件底部:
# Samba share for Windows clients
[my-shared-folder-name]
path = /myshares
available = yes
valid users = peterlustig
read only = no
browseable = yes
public = yes
writable = yes
Run Code Online (Sandbox Code Playgroud)sudo /etc/init.d/samba restart
重新启动服务器并重新加载配置
ufw
防火墙,则需要对其进行配置。例如,我只允许 192.xxx.xxx.xxx 主机访问我的 Samba 共享,所以我输入:sudo ufw allow from 192.0.0.0/8 to any app Samba
\\192.168.2.42
。现在,您应该会my-shared-folder-name
在[]
括号中看到第 8 步中命名的共享文件夹。打开它。现在您需要输入您的凭据,即peterlustig
您在步骤 6 中输入的用户名和密码。您甚至可以将其映射为 Windows 网络驱动器。地址将是\\192.168.2.42\my-shared-folder-name
,并且不要忘记启用使用不同的凭据(与您的 Windows 10 用户提供的凭据不同)并peterlustig
从第 6 步那里输入密码。
希望这对任何人都有帮助。快乐分享!
归档时间: |
|
查看次数: |
29113 次 |
最近记录: |