服务器端

/etc/exports

/mnt *(rw,sync,no_root_squash,anonuid=500,anongid=500)
systemctl restart nfs

客户端

挂载有两种

1.mount -t nfs 192.168.100.124:/mnt /test

vim /etc/fstab

nfs挂载:192.168.100.124:/mnt/  /test  nfs  defaults 0 0

window共享后的挂载方式:

192.168.100.X/mnt  /test  cifs  defaults ,auto,uid=500,gid=500,domain=abc,username=abc.password=abc  0 0

2.使用autofs

vim /etc/auto.master

添加自动挂载的路径 和配置文件

例子:

在auto.master中添加/ceshi/guazai   /etc/auto.mvp         这里/ceshi/guazai 是挂载路径,此时如果ceshi目录不存在,他会自动创建,如果guazai目录存在,他会将挂载目录的内容移到缓存中,并根据auto来挂载新的数据,此时guazai目录无法被写入。请确保改路径下没有数据。
vim /etc/auto.mvp
nfs -fstype=nfs 192.168.100.124:/mnt            nfs表示挂载的路径文件名,会自动生成这个文件夹
systemctl start autofs

参考连接:https://blog.51cto.com/pascaljanus/495132

如果根据账号密码则如下设置:

    1. root@localhost:~# cat /etc/auto.misc
    2. backup      -fstype=cifs,username=backup_user@domain,password=backup_password      ://192.168.1.1/backup

以下是转载的参考链接:

链接地址:https://blog.51cto.com/pascaljanus/495132

1.检查和安装autofs

  1. dpkg -l | grep autofs
  2. sudo apt-get install autofs5

2.编辑/etc/auto.master文件,启用misc目录

  1. root@localhost:~# cat /etc/auto.master
  2. #
  3. # Sample auto.master file
  4. # This is an automounter map and it has the following format
  5. # key [ -mount-options-separated-by-comma ] location
  6. # For details of the format look at autofs(5).
  7. #
  8. /misc   /etc/auto.misc
  9. #
  10. # NOTE: mounts done from a hosts map will be mounted with the
  11. #   "nosuid" and "nodev" options unless the "suid" and "dev"
  12. #   options are explicitly given.
  13. #
  14. #/net   -hosts
  15. #
  16. # Include central master map if it can be found using
  17. # nsswitch sources.
  18. #
  19. # Note that if there are entries for /net or /misc (as
  20. # above) in the included master map any keys that are the
  21. # same will not be seen as the first read key seen takes
  22. # precedence.
  23. #
  24. +auto.master

3.修改/etc/auto.misc文件,添加cifs挂载项

  1. root@localhost:~# cat /etc/auto.misc
  2. backup      -fstype=cifs,username=backup_user@domain,password=backup_password      ://192.168.1.1/backup

4.重启autofs服务

  1. root@localhost:~# service autofs restart

5.检查是否成功挂载

  1. root@localhost:~# ls -l /misc/backup
  2. total 3
  3. drwxrwxrwx 1 root root    0 2011-02-16 10:25 dns_backup
  4. drwxrwxrwx 1 root root    0 2011-02-16 09:37 mail_backup
  5. drwxrwxrwx 1 root root    0 2011-02-16 09:30 system_backup
  6. root@localhost:~# mount
  7. ...
  8. //192.168.1.1/backup on /misc/backup type cifs (rw,mand)

值得注意的是如果通过AD域来认证,则要在用户名后加@domain(domain是AD域的域名,如company.com)才能成功挂载,尝试过用户名的另一种表示方法,domain\username,但不是每一次都能成功,所以选择前者。虽然挂载选项显示可读写,但要在远端服务器上设置相应的权限才能操作

nfs自动挂载的更多相关文章

  1. linux NFS 自动挂载

    NFS 自动挂载的两种方法 第一种: 需要注意的事项 开机挂载的命令不能写入到/etc/fstab 中,由于 NFS 依赖于网络,而/etc/fstab 的引用是在计算机 网络尚未启动的时候就开始引导 ...

  2. autofs实现nfs自动挂载

    apt-get install autofs 主配置文件/etc/auto.master 副配置文件可以在之配置文件中自定义 能生效的配置文件如下例: 将/usr/local/nginx/html挂载 ...

  3. NFS使用autofs自动挂载

    NFS自动挂载设置在/etc/fstab和/etc/rc.local可能挂载不成功,假如是服务端NFS宕机还可能导致客户端无法启动,可以使用autofs实现自动挂载 安装autofs yum -y i ...

  4. NFS配置及开机自动挂载

    环境:Red Hat  6.7 服务端:192.168.163.128 客户端:192.168.163.131 背景:解决多个服务器之间数据共享 环境检查: 1.检查服务器是否安装nfs服务 rpm  ...

  5. ubuntu 开机自动挂载nfs服务器上的home分区

    通过‘fstab’也可以配置 NFS 和 SMB 的共享目录.由于涉及到的可选项很重要,并且需要了解一些协议的工作情况,您得先阅读 Samba 和 NFS . 基本语法和本地介质相差不是很多.条目中的 ...

  6. Linux:SAMBA共享、NFS共享、Autofs自动挂载

    SAMBA.NFS共享区别 NFS开源文件共享程序:NFS(NetworkFile System)是一个能够将多台Linux的远程主机数据挂载到本地目录的服务,属于轻量级的文件共享服务,不支持Linu ...

  7. NFS 开机自动挂载共享目录

    开机自动挂载: 如果服务端或客户端的服务器重启之后需要手动挂载,我们可以加入到开机自动挂载 在服务端/客户端的/etc/fstab里添加 192.168.22.204:/opt/filestore  ...

  8. Linux服务——二、配置NFS及autofs自动挂载服务

    一.NFS服务配置步骤 NFS的作用:能够使两台虚拟机之间实现文件共享.数据同步 准备:主机名.网络.yum源 Server端: 1.安装nfs-util和rpcbind:(图形化自带) [root@ ...

  9. 实现nfs持久挂载+autofs自动挂载

    实验环境: 两台主机 node4:192.168.37.44 NFS服务器 node2:192.168.37.22 客户端 在nfs服务器,先安装nfs和rpcbind [root@node4 fen ...

随机推荐

  1. Google的搜索API的Delphi封装

    这个东西实现了已经有一段时间了,那个时候谷歌还没有退出中国内地呢!而现在呢,谷歌都退了有一些日子了!紧以此纪念一番! 话说谷歌API,我相信很多人应该都知道!不晓得在实际应用中,用的人多不多(我说的不 ...

  2. HDU 5495:LCS

    LCS  Accepts: 127  Submissions: 397  Time Limit: 6000/3000 MS (Java/Others)  Memory Limit: 65536/655 ...

  3. Live555 的一个缺陷–例子不能支持多线程(已经修改成支持多线程)

    我对Live555进行了一次封装,但是Live555 是单线程的,里面定义的全局变量太多,我封装好dll库后,在客户端调用,因为多个对话框中要使用码流,我就定义了多个对象从设备端接收码流,建立多个连接 ...

  4. 官网英文版学习——RabbitMQ学习笔记(十)RabbitMQ集群

    在第二节我们进行了RabbitMQ的安装,现在我们就RabbitMQ进行集群的搭建进行学习,参考官网地址是:http://www.rabbitmq.com/clustering.html 首先我们来看 ...

  5. 【pwnable.kr】cmd1

    最近的pwnable都是linux操作系统层面的. ssh cmd1@pwnable.kr -p2222 (pw:guest) 首先还是下载源代码: #include <stdio.h> ...

  6. centos7下使用yum安装ifconfig工具

    步骤1:搜索安装包 步骤2:使用yum安装 至此,ifconfig工具安装完毕,希望对你有帮助~

  7. 14 SQLite数据库

    SQLite数据库SQLite 是一款轻型的数据库SQLite 的设计目标是嵌入式的SQLite 占用资源低SQL 指结构化查询语言SQL 使我们有能力访问数据库SQL 是一种 ANSI 的标准计算机 ...

  8. windows driver 定时器的使用

    #include < Ntifs.h> #pragma warning(disable:4995) #pragma comment(lib, "Ntoskrnl.lib" ...

  9. java向python ,text文件动态传参或传值问题完美解决

    由于业务需要对python文件进行参数传递,通过下面两个java方法完美解决此问题,我的思路是:首先我要先把上次写的参数删除,第二我要新的参数写到python文件中. 第一个方法解决了删除上次传递的参 ...

  10. PWC6199:Generated servlet error:Only a type can be imported. org.apache.jasper.tagplugins.jstl.core.ForEach resolves to a package

    <%@ import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> 去掉这条语句,就不报错了.所以问题就出在这里 ...