linux 与 windows 互相访问共享目录

转载自:https://www.cnblogs.com/scotth/p/3975177.html

linux mount   linux folder

sudo mount -t auto /dev/sdb2 ~/800G

 

http://man.linuxde.net/mount

 

复制代码

 mount命令用于加载文件系统到指定的加载点。此命令的最常用于挂载cdrom,使我们可以访问cdrom中的数据,因为你将光盘插入cdrom中,Linux并不会自动挂载,必须使用Linux mount命令来手动完成挂载。
语法

mount(选项)(参数)

选项

-V:显示程序版本;
-l:显示已加载的文件系统列表;
-h:显示帮助信息并退出;
-v:冗长模式,输出指令执行的详细信息;
-n:加载没有写入文件“/etc/mtab”中的文件系统;
-r:将文件系统加载为只读模式;
-a:加载文件“/etc/fstab”中描述的所有文件系统。

参数

    设备文件名:指定要加载的文件系统对应的设备名;
    加载点:指定加载点目录。

实例

mount -t auto /dev/cdrom /mnt/cdrom
mount: mount point /mnt/cdrom does not exist           /mnt/cdrom目录不存在,需要先创建。

cd /mnt
-bash: cd: /mnt: No such file or directory

mkdir -p /mnt/cdrom    创建/mnt/cdrom目录
ls
bin   dev  home    lib         media  mnt  proc  sbin     srv  tmp  var
boot  etc  initrd  lost+found  misc   opt  root  selinux  sys  usr

mount -t auto /dev/cdrom /mnt/cdrom     挂载cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only     挂载成功

ll /mnt/cdrom    查看cdrom里面内容
total 859
dr-xr-xr-x  4 root root   2048 Sep  4  2005 CentOS
-r--r--r--  2 root root   8859 Mar 19  2005 centosdocs-man.css
-r--r--r--  9 root root  18009 Mar  1  2005 GPL
dr-xr-xr-x  2 root root 241664 May  7 02:32 headers
dr-xr-xr-x  4 root root   2048 May  7 02:23 images
dr-xr-xr-x  2 root root   4096 May  7 02:23 isolinux
dr-xr-xr-x  2 root root  18432 May  2 18:50 NOTES
-r--r--r--  2 root root   5443 May  7 01:49 RELEASE-NOTES-en.html
dr-xr-xr-x  2 root root   2048 May  7 02:34 repodata
-r--r--r--  9 root root   1795 Mar  1  2005 rpm-GPG-KEY
-r--r--r--  2 root root   1795 Mar  1  2005 RPM-GPG-KEY-centos4
-r--r--r--  1 root root 571730 May  7 01:39 yumgroups.xml

复制代码

 

 

 

 

 

 

 

 

 

 

 

 

 

需要注意的是windows 的【管理】【本地用户和组】 如果没有开启【guest】 用户,则linux mount 必须带-o 选项, 输入用户密码

sudo mount -t cifs -o username=myusername,password="mypassword" //192.168.1.105/ShareFolderLinux  ~/shareFolder4Win/

myusername,  mypassword 是我windows的帐号密码

 

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

windows 打开【linux共享目录】

samba ubuntu 设置共享目录

http://wiki.ubuntu.com.cn/Samba

 

 

------------

linux mount 【windows的共享目录】

 


 http://www.cnblogs.com/itech/archive/2010/02/02/1662062.html

 

 

http://jingyan.baidu.com/article/b7001fe1694b800e7282dde4.html

 

 

在Linux下使用mount命令挂载Windows 上的共享文件夹。本经验使用Redhat Linux6.5和windows2012作为实践平台。

工具/原料

  • Windows操作系统上建立共享文件夹

  • Linux操作系统。

方法/步骤

  1. mount -t cifc "windows共享文件夹" "Linux /mnt路径"

    i.e. mount -t cifs //16.187.190.60/test /mnt/

    Linux 会要求输入访问Windows 共享文件夹上的密码。

    注意:

    Linux中提示:

    Unable to find suitable address. 

    说明远程共享文件夹路径不存在。请仔细检查,并更正目录路径。

    Linux mount 命令挂载 Windows 共享文件夹

  2. mount -t cifc "windows共享文件夹" "Linux /mnt路径"

    i.e. mount -t cifs //16.187.190.50/test /mnt/

    注意:

    Linux中提示:

    mount error(13): Permission denied

    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    解决方案:将访问Windows共享目录的用户名和密码直接加入到命令中。

    Linux mount 命令挂载 Windows 共享文件夹

  3. mount -t cifs -o username=WindowsLogin,password="passwordinWindows"

     //16.187.190.50/test /mnt/

    注意:该命令中,username为windows上的用户;password为window用户对应的密码

    Linux mount 命令挂载 Windows 共享文件夹

  4. 步骤3的命令也可以使用以下方式实现:

    mount.cifs -o username="Administrator",password="PasswordForWindows" //16.187.190.50/test /mnt/

    Linux mount 命令挂载 Windows 共享文件夹

  5. 通过步骤3和步骤4可以成功将windows共享文件夹挂载在/mnt目录下。不过由于mount命令只能由root权限用户使用。其挂载文件夹的默认owner和group都为root,并且不能通过chmod命令更改权限。

    Linux mount 命令挂载 Windows 共享文件夹

  6. 使用mount命令,给挂载共享文件夹指定owner和group.

    mount.cifs -o username="Administrator",password="PasswordForWindows",uid=Mysa,gid=Mysa //16.187.190.50/test /mnt/

    Linux mount 命令挂载 Windows 共享文件夹

  7. 检查/mnt/中文件夹的owner和group。

    Linux mount 命令挂载 Windows 共享文件夹

  8. 更改文件夹权限。给mount共享文件夹所在组的写权限。

    mount.cifs -o username="Administrator",password="PasswordForWindows",Mysa,gid=Mysa,dir_mode=0777 //16.187.190.50/test /mnt/

    Linux mount 命令挂载 Windows 共享文件夹

    Linux mount 命令挂载 Windows 共享文件夹

    END

注意事项

  • mount命令需要root权限才能运行

 

 

mount -t cifs -o username=scott,password="123456" //192.168.1.104/ShareFolderLinux  ~pi/shareFolder4Win/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值