centos虚拟机设置共享文件夹并通过我的电脑访问

前端之家收集整理的这篇文章主要介绍了centos虚拟机设置共享文件夹并通过我的电脑访问前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、使用的软件叫samba,yum install samba即可

2、修改配置文件如下

  1. setsebool -P samba_domain_controller on
  2. setsebool -P samba_enable_home_dirs on
  3. setsebool -P samba_export_all_rw on
  4. [global]
  5. workgroup = UPOA
  6. server string = Samba Server Version %v
  7. create mask = 0777
  8. directory mask = 0777
  9. # log files split per-machine:
  10. log file = /var/log/samba/log.%m
  11. # maximum size of 50KB per log file,then rotate:
  12. max log size = 50
  13. security = user
  14. # the following login script name is determined by the machine name
  15. # (%m):
  16. # the following login script name is determined by the UNIX user used:
  17. # use an empty path to disable profile support:
  18. # varIoUs scripts can be used on a domain controller or a stand-alone
  19. # machine to add or delete corresponding UNIX accounts:
  20. load printers = yes
  21. cups options = raw
  22. # obtain a list of printers automatically on UNIX System V systems:
  23. [homes]
  24. comment = Home Directories
  25. browseable = no
  26. writable = yes
  27. [printers]
  28. comment = All Printers
  29. path = /var/spool/samba
  30. browseable = no
  31. guest ok = no
  32. writable = no
  33. printable = yes
  34. [public]
  35. comment = public file
  36. path = /home/xx
  37. valid users = root
  38. writable = yes
  39. browseable = yes
  40. ~
注意:"#"和" ; "开头的配置文件都是注释,不同之处在于“ ; ”可要可不要,#是完全可以不要。

3、修改强制访问控制(SELinux 全称 Security Enhanced Linux (安全强化 Linux),是 MAC (Mandatory Access Control,强制访问控制系统)的一个实现,目的在于明确的指明某个进程可以访问哪些资源(文件、网络端口等)。)

setsebool -Psamba_enable_home_dirs on
setsebool -Psamba_export_all_rw on
完事儿之后再:getsebool -a | grep samba一把

4、重启smb服务service smb restart

5、在windows我的电脑里输入ip即可访问


参考链接

http://bbs.51cto.com/thread-703270-1.html http://blog.chinaunix.net/uid-23069658-id-3142052.html http://blog.csdn.net/testcs_dn/article/details/19758163

猜你在找的CentOS相关文章