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

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

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

2、修改配置文件如下

setsebool -P samba_domain_controller on
setsebool -P samba_enable_home_dirs on
setsebool -P samba_export_all_rw on
[global]
        workgroup = UPOA
        server string = Samba Server Version %v
        create mask = 0777
        directory mask = 0777
        # log files split per-machine:
        log file = /var/log/samba/log.%m
        # maximum size of 50KB per log file,then rotate:
        max log size = 50
        security = user
        # the following login script name is determined by the machine name
        # (%m):
        # the following login script name is determined by the UNIX user used:
        # use an empty path to disable profile support:
        # varIoUs scripts can be used on a domain controller or a stand-alone
        # machine to add or delete corresponding UNIX accounts:
        load printers = yes
        cups options = raw
        # obtain a list of printers automatically on UNIX System V systems:
[homes]
        comment = Home Directories
        browseable = no
        writable = yes
[printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = no
        guest ok = no
        writable = no
        printable = yes
[public]
        comment = public file
        path = /home/xx
        valid users = root
        writable = yes
        browseable = yes
~                         
注意:"#"和" ; "开头的配置文件都是注释,不同之处在于“ ; ”可要可不要,#是完全可以不要。

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

原文链接:https://www.f2er.com/centos/380463.html

猜你在找的CentOS相关文章