• windows访问linux共享文件夹


    1.windows的网上邻居,是通过smb协议来共享信息的,如果需要给访问linux上的共享目录被windows访问到,需要linux有smb协议

    sudo apt-get install samba #安装samba服务
       sudo apt-get install smbfs #安装smbfs服务

    2.安装好服务后,启动服务

    harvey@harvey:/etc/samba$ service smbd restart 
    stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.26" (uid=1000 pid=2707 comm="stop smbd ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
    start: Rejected send message, 1 matched rules; type="method_call", sender=":1.27" (uid=1000 pid=2701 comm="start smbd ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
    harvey@harvey:/etc/samba$ sudo vim smb.conf

    3.在服务器端CTR+R 输入\IP 地址,发现可以正常连接到共享主机了,但是发现没有共享文件夹。所以现在需要在/etc/samba/smb.conf添加共享目录。

    4.首先运行testparm来查看配置的信息

    harvey@harvey:~$ testparm #运行testparm 查看配置
    Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    Processing section "[harveyLinux]"
    Processing section "[printers]"
    Processing section "[print$]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    Press enter to see a dump of your service definitions #查看服务器所有配置
    
    [global]
        server string = %h server (Samba, Ubuntu)
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Entersnews*spassword:* %n
     *Retypesnews*spassword:* %n
     *passwordsupdatedssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb
    
    [harveyLinux]            #修改默认的文件夹这里是共享的文件夹的名称
        path = /home/harvey             #共享文件夹的路径
        read only = No                   #可读可写
        guest ok = Yes                       #可以通过访客访问
    
    [printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        print ok = Yes
        browseable = No
    
    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers

    5.以上红色的部分就是要共享文件需要添加(或者叫更改)的数据内容.

    6.为了让window可以操作共享的文件夹,需要修改权限

    harvey@harvey:/home$ chmod 777  harvey/ -R
    harvey@harvey:/home$ ls -l
    total 4
    drwxrwxrwx 7 harvey harvey 4096 Apr  7 12:44 harvey

  • 相关阅读:
    前端基础进阶变量对象详解
    伪元素::before与::after的用法
    网站性能优化你需知道的东西
    Python爬虫音频数据
    python一步高级编程
    Android APK打包流程
    软件漏洞学习
    pycrypto 安装
    ubuntu16.04中将python3设置为默认
    Android NDK 编译选项设置[zhuan]
  • 原文地址:https://www.cnblogs.com/zhanghaiyublog/p/3650230.html
Copyright © 2020-2023  润新知