zoukankan      html  css  js  c++  java
  • Windows访问Linux下的共享目录的配置方法

    user安全级别

    第一步:安装samba3(如果已经安装就跳过这一步) 

    [root@rhce2 /]# yum groupinstall "CIFS file server"

    第二步:修改配置文件

    [root@rhce2 /]# vi /etc/samba/smb.conf

    将security参数的值设为user(这是默认值)

    security = user

    第三步:创建可以访问共享目录的用户

    [root@rhce2 test]# useradd tommy

    第四步:修改用户密码(红色的两行是因为RedHat6对密码的安全级别要求较高)

    [root@rhce2 test]# passwd tommy

    Changing password for user tommy.

    New password:

    BAD PASSWORD: it does not contain enough DIFFERENT characters

    BAD PASSWORD: is a palindrome

    Retype new password:

    passwd: all authentication tokens updated successfully.

    第五步:将tommy添加为samba用户

    [root@rhce2 test]# smbpasswd -a tommy

    New SMB password:

    Retype new SMB password:

    Added user tommy.

    第六步:修改配置文件/etc/samba/smb.conf,配置共享目录

    [sambashare_user]

    comment = test resource

    path = /sambashare_user

    writable = yes

    browseable = yes

    write list = tommy

    public = no

    第七步:将用户tommy的家目录屏蔽起来

    ;[homes]

    ;      comment = Home Directories

    ;      browseable = no

    ;      writable = yes

    ;      valid users = %S

    ;      valid users = MYDOMAIN\%S

    默认情况下,[homes],browseable,writable参数前面是没有分号的,这样客户端就能看到用户tommy的家目录,

    这样不安全,所以要在[homes],browseable,writable前面加上分号,这样在客户端就只能看见sambashare_user

    这一个目录了

    第八步:创建共享目录,并修改selinux的上下文权限及目录所有者

    [root@rhce2 /]# mkdir sambashare_user

    [root@rhce2 /]# chcon -t samba_share_t sambashare_user

    [root@rhce2 /]# ls -adlZ sambashare_user

    drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 sambashare_user

    [root@rhce2 /]# chown tommy.root sambashare_user

    [root@rhce2 /]# ls -adlZ sambashare_user

    drwxr-xr-x. tommy root unconfined_u:object_r:samba_share_t:s0 sambashare_user

    第九步:重启samba服务

    [root@rhce2 /]# service smb restart

    Shutting down SMB services:                                [  OK  ]

    Starting SMB services:                                    [  OK  ]

    第十步:在windows上面创建一个用户tommy

    第十一步: 在我的电脑中输入\192.168.1.120,键入回车键

    第十二步:双击共享目录sambashare_user,输入用户名tommy及其密码(这个用户是windows上新建的用户)

    然后点击【确定】按钮

    第十三步:在该文件夹中,新建一个文件test.txt

    到此一个Linux下的基于user级别的共享目录就共享完成了,在Windows下就可以访问它了

  • 相关阅读:
    Eclipse RCP应用程序无法关闭,需在进程栏关闭
    JAVA代码BUG检测工具
    Eclipse客户端程序中多线程的使用(转载)
    geotools获取shapefile 属性名乱码问题
    近距离P2P通讯技术平台 Alljoyn
    Eclipse a tale of two VMs (and many classloaders) (转载)
    深入 Eclipse 多线程机制(转载)
    Top 10 mistakes in Eclipse Plugin Development
    EclipseRCP软件的P2升级资料收集
    java事件处理机制 自定义事件(转载)
  • 原文地址:https://www.cnblogs.com/hanson666/p/7100976.html
Copyright © 2011-2022 走看看