ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux mount挂载共享目录

linux mount挂载共享目录

Linux操作系统 作者:eddy0lion 时间:2016-10-20 17:18:03 0 删除 编辑
原文地址:http://lym6520.iteye.com/blog/1850737
挂载windows共享目录或FTP:
 
方式一:包含密码 
Shell代码  收藏代码
  1. sudo mount //192.168.10.22/FTPServer /windows -o username=user,password=abcdefg -t cifs  

方式二:密码单独输入 
Shell代码  收藏代码
  1. sudo mount //192.168.10.22/FTPServer /windows -o username=user -t cifs  
  2. password:abcdefg  

卸载: 
Shell代码  收藏代码
  1. umount /FTPServer  


挂载linux共享目录: 
【修改server端】 
修改/etc/export文件,加入: 
Shell代码  收藏代码
  1. /home/user/source *(rw)  

执行如下命令是新增的共享生效 
Shell代码  收藏代码
  1. $/etc/rc.d/init.d/nfs restart  


【客户端】执行如下命令挂载共享: 
Shell代码  收藏代码
  1. mount -t nfs -o rw 192.168.10.94:/home/user/source /home/user/target  


设置开机启动自动挂载 

1、修改mount_AtoB.sh的密码 
2、将mount_AtoB.sh文件放到/home/user目录下 
3、改变文件的执行权限,执行如下命令: 
Shell代码  收藏代码
  1. chmod 777 mount_AtoB.sh  

4、将文件加入到启动文件中: 
Shell代码  收藏代码
  1. $ echo /home/user/mount_94to93.sh >> /etc/rc.d/rc.local  


mount_AtoB.sh文件内容,其中abcdefg为192.168.10.94的密码: 
Mount_atob.sh代码  收藏代码
  1. set fileformat=unix  
  2. #!bin/bash  
  3. mount -t nfs -o rw 192.168.10.94:/home/user/source /home/user/target <<EOF  
  4. abcdefg  
  5. EOF  

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28853590/viewspace-2126825/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-11-05

  • 博文量
    47
  • 访问量
    81775