服务端
安装samba
sudo apt-get install samba samba-common
添加用户(下面的linuxidc是我的用户名,之后会需要设置samba的密码)
sudo smbpasswd -a linuxidc
创建共享文件夹
mkdir -p /home/linuxidc/share
设置目录权限
chmod 777 /home/linuxidc/share
修改配置文件/etc/samba/smb.conf,关键配置如下:
[global]
follow symlinks = yes
wide links = yes
unix extensions = no
[project]
comment = project directory
path = /home/linuxidc/share
public = yes
browseable = yes
public = yes
read only = no
writable = yes
valid users = linuxidc
create mask = 0777
directory mask = 0777
force user = linuxidc
force group = linuxidc
available = yes
客户端
linux
首先安装cifs utils
sudo apt-get install cifs-utils
新建挂载目录
mkdir -p /mnt/share
挂载的终端命令
sudo mount -t cifs -o username=USER,password=PASSWORD,dir_mode=0777,file_mode=0777 //192.168.0.111/project /mnt/share;
挂载成功后,/mnt/share里面就能看到共享内容啦
windows
我的电脑右键,映射网络驱动器
![CleanShot-2020-08-05_10.04.41@2x](../../../../../../../Application Support/CleanShot/media/media_jhcnXMY3rl/CleanShot-2020-08-05_10.04.41@2x.png)
输入ip和路径
后续输入账号密码,就可以在我的电脑里看到共享文件夹啦