Ubuntu服务器装了新硬盘后,共享个文件夹,方便其他机器访问传输数据。
运行samba
1
2
3
4
5
6$ samba
[2021/08/05 08:25:00.658854, 0] ../lib/util/debug.c:947(reopen_logs_internal)
Unable to open new log file '/var/log/samba/log.%m': Permission denied
[2021/08/05 08:25:00.658888, 0] ../source4/smbd/server.c:372(binary_smbd_main)
samba version 4.3.11-Ubuntu started.
Copyright Andrew Tridgell and the Samba Team 1992-2015若没有samba服务需要安装
1
$ sudo apt-get install samba
备份及修改配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19# 备份
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# 修改
$ sudo vi /etc/samba/smb.conf
# 增加如下内容
[sharename] # 共享文件夹名字
comment = comment # 备注
path = /home/xxx/xxx # 路径
public = yes
browseable = yes
public = yes
writeable = yes
read only = no
create mask = 0777
directory mask = 0777
#force user = nobody
#force group = nogroup
available = yes重启服务
1
$ sudo service smbd restart
此时文件夹访问的话权限有问题,chmod改下权限
1
$ sudo chmod 777 /home/xxx/xxx
以上,完工~!共享起来使用还是很方便的,另外内网穿透一下外网也可以访问呦^_^