Linux 系统安装samba服务共享文件夹
【摘要】 Linux 共享文件夹
一、Ubuntu系统
1、安装Samba
sudo apt-get install samba
2、配置Samba
sudo vim /etc/samba/smb.conf
3、添加以下内容
[HarmonyOS_Code]
path = /home/master/MasterData/BearPiHMNano
available = yes
valid users = master
read only = no
browsable = yes
public = yes
writable = yes
4、把当前的用户设置为Samba用户,并设置密码
sudo smbpasswd -a master
5、重启Samba
sudo systemctl restart smbd.service
二、CentOS8 系统
1、安装Samba服务
[root@masterserver samba]# yum install samba
2、配置Samba
[root@masterserver samba]# ll
total 24
-rw-r--r--. 1 root root 20 Apr 24 2020 lmhosts
-rw-r--r--. 1 root root 706 Apr 24 2020 smb.conf
-rw-r--r--. 1 root root 706 Dec 28 10:25 smb.conf.backup20201228
-rw-r--r--. 1 root root 11327 Apr 24 2020 smb.conf.example
[root@masterserver samba]# vim smb.conf
[HarmonyOSCode]
path = /home/master/MasterData/HarmonyOSSharedCode
available = yes
valid users = master
read only = no
browsable = yes
public = yes
writable = yes
4、把当前的用户设置为Samba用户,并设置密码
[root@masterserver master]# smbpasswd -a master
New SMB password:
Retype new SMB password:
Added user master.
[root@masterserver master]#
5、重启Samba
[root@masterserver master]# systemctl restart smb.service
[root@masterserver master]# systemctl status smb.service
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-12-28 10:37:42 JST; 12s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 3822 (smbd)
Status: "smbd: ready to serve connections..."
Tasks: 4 (limit: 49448)
Memory: 8.1M
CGroup: /system.slice/smb.service
├─3822 /usr/sbin/smbd --foreground --no-process-group
├─3826 /usr/sbin/smbd --foreground --no-process-group
├─3827 /usr/sbin/smbd --foreground --no-process-group
└─3828 /usr/sbin/smbd --foreground --no-process-group
6、设置Samba服务开机启动
[root@masterserver master]# systemctl enable smb.service
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)