对于Samba的解释可以参考百度的解释:https://baike.baidu.com/item/samba/455025?fr=aladdin
我这次是实现linux 中的文件与Windows 共享。
1.创建一个用户
[root@intel-obmc ~]# useradd xiao [root@intel-obmc ~]# passwd xiao Changing password for user xiao. New password: BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word Retype new password: passwd: all authentication tokens updated successfully.
2.在创建用户下创建共享文件夹和文件
[root@intel-obmc ~]# cd /home/xiao/ [root@intel-obmc xiao]# mkdir share [root@intel-obmc share]# chmod 777 share.txt [root@intel-obmc share]# vim share.txt xiaozhan is so handsome he is an actor i like him very much ~
3. 查看是否有samba ,我发现我正在使用的系统就是自带这个软件了,因此这步直接Pass.
4.将刚刚创建的用户添加到samba 中:
[root@intel-obmc share]# smbpasswd -a xiao New SMB password: Retype new SMB password: Added user xiao.
5. 检查是否在samba的列表中:
[root@intel-obmc share]# pdbedit -L xiao:1001:
6. 检查防火墙是否关闭:
[root@intel-obmc share]# firewall-cmd --state not running [root@intel-obmc share]#
7.修改samba的配置文件
[root@intel-obmc ~]# vim /etc/samba/smb.conf [global] workgroup = workgroup security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [homes] comment = Home Directories path = /home/xiao/share valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes
8. 重启samba服务
[root@intel-obmc ~]# systemctl restart smb [root@intel-obmc ~]#
9.修改共享文件的权限以及查看共享文件的权限
[root@intel-obmc share]# chown xiao share.txt [root@intel-obmc share]# ls -l total 4 -rwxrwxr-x 1 xiao root 62 Nov 13 05:33 share.txt [root@intel-obmc share]#
10.查看本机的ip地址
11.在Windows 的系统下就可以查看到了:
A:win+R
B.输入最先创建的用户的信息
完成~~