zoukankan      html  css  js  c++  java
  • linux 访问windows共享文件夹的方法

    linux 访问windows共享文件夹的方法

    sudo mount -t cifs -o username=Administrator,password=198106 //192.168.0.81/abc /mnt/share

    abc是windows共享文件夹
     /mnt/share 新建一个文件夹share

    cbx@cbx-MS-7592 /mnt/share $ sudo mount -t cifs -o username=Administrator,password=198106 //192.168.0.81/abc /mnt/share

    ==============================================================================

    有时需要在linux下需要访问windows的共享文件夹,可以使用mount挂载或者使用samba连接。

    1、mount挂载

    首先创建被挂载的目录:

    $ mkdir windows

    将共享文件夹挂载到windows文件夹:

    $ sudo mount -t cifs -o username=share,password=share //192.168.66.198/share ./windows

    其中几个参数表示含义:

        cifs:Common Internet File System,可以理解为网络文件系统。
        usrname:访问共享文件夹的用户名
        password:访问密码
        //192.168.66.198/share:表示网络文件夹的地址,注意这里最后不能加/,如果是//192.168.66.198/share/则会报如下错误:mount: //192.168.66.198/share/ is not a valid block device

    Tips:使用mount挂载的方法在系统重新启动后就会失效,如果希望开机时自动挂载,将下面设置加入/etc/fstab文件最后面就可以了。

    //192.168.66.198/share /home/windows cifs defaults,username=share,password=share 0 2

    其中/home/windows表示挂载点,就是上面windows目录的完整路径。

    2、使用samba连接

    samba就是让windows和unix系列os之间的文件可以互相访问的软件。使用samba访问windows的共享文件夹,需要安装smbclient。

    $ sudo apt-get install smbclient

    安装好后,就可以访问共享的文件了。

    $ smbclient --user=share //192.168.66.198/share
    Enter share's password: (输入密码回车)
    smb: >

    此时进入了smb的命令操作空间,可以使用help来查看命令的使用。

    smb: > help

    ......省略若干命令......
    exit           get            getfacl        geteas         hardlink
    help           history        iosize         lcd            link
    ......省略若干命令......

    也可以使用help查看单个命令的使用方式

    smb: > help get

    HELP get:
             [local name] get a file

    小结

    使用mount命令相对来说简单一些,基本linux系统都会带有这个命令;使用samba的话从windows也能访问linux的共享文件。根据自己喜好选择就可以了,有什么疑问可以给我留言。

    =====================================================

    mount.cifs windows共享目录权限755问题,百度搜索 cifs 共享文件夹只读
    可以通过file_mode 和dir_mode 来设置权限,覆盖默认的755权限,取消共享文件夹只读
    sudo mount -t cifs -o username=Administrator,password=198107,rw,dir_mode=0777,file_mode=0777 //192.168.0.81/abc /home/cbx/abc

    =====================================================

    linux 访问windows共享文件夹的方法
    cnblogs.com 有收藏

    linux访问windows共享文件夹的两种方法
    http://www.01happy.com/linux-access-windows-shares-folders/

    博客转自:http://www.01happy.com/linux-access-windows-shares-folders/

    安装samba服务器实现Linux mint和Windows共享文件
    csdn.net 有收藏

  • 相关阅读:
    TYPE_SCROLL_INSENSITIVE is not compatible with CONCUR_UPDATABLE
    with admin option /with grant option
    通过动态SQL语句创建游标
    Vue:在vue-cli中使用Bootstrap
    Vue:$set和$delete
    Vue:如何在vue-cli中创建并引入自定义组件
    MVC教程四:Controller向View传值的几种方式
    Vue:生命周期
    Vue.js常用指令:v-model
    vue:过滤器
  • 原文地址:https://www.cnblogs.com/xcb0730/p/9752208.html
Copyright © 2011-2022 走看看