1.安装Samba
-
sudo apt update
-
sudo apt install samba
-
smbd --version
2. 配置Samba
sudo vim /etc/samba/smb.conf, 增加下面的行
-
[sambashare]
-
comment= Network Shared Folder by Samba Server on Ubuntu
-
path = /home/your_username/sambashare
-
force user = smbuser
-
force group = smbgroup
-
create mask = 0664
-
force create mode = 0664
-
directory mask = 0775
-
force directory mode = 0775
-
public = yes
-
read only = no
3. 配置环境
-
#-- check current user
-
echo $USER
-
#-- goto user's home folder
-
cd ~
-
# create sambashare folder
-
mkdir -p sambashare
-
# prepare usergroup and user for samba anonymous access
-
sudo groupadd --system smbgroup
-
sudo useradd --system --no-create-home --group smbgroup -s /bin/false smbuser
-
sudo chown -R smbuser:smbgroup ~/sambashare
-
sudo chmod -R g+w ~/sambashare
-
# restart samba daemon service in background
-
sudo systemctl restart smbd
-
sudo systemctl status smbd
-
# if ufw enabled, then we need to enable the samba network resource entry
-
sudo ufw enable samba
4. 测试
-
# windows check
-
in explorer:
-
\\ip_address_of_pc_with_shared_folder\sambashare
-
in ubuntu box
-
smb://ip_adresss_of_pc_with_shared_folder/sambashare
zenith
2022-04-30 闭关修炼中
阅读(1184) | 评论(0) | 转发(0) |