Ubuntu添加网络映射路径

devtools/2024/9/23 9:02:20/

参考资料

linux挂在阿里云盘(webdav协议)给服务器扩容、备份数据等_davfs2-CSDN博客

Linux将WebDAV为本地磁盘 - 夏日冰菓 (lincloud.pro)

systemd系统开机运行rc.local_rc-local.service: failed to execute command: exec -CSDN博客

系统版本:

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-105-generic x86_64)

现有webdev地址:http://192.168.3.2:5005/185xxxx/very-mount/linuxServer,以及webdev账号密码

欲挂载在linux的\home\kono707da\nas-mount路径下

  1. 安装davfs2

    apt-get install davfs2
    
  2. 挂载网络磁盘

    sudo mount -t davfs http://192.168.3.2:5005/185xxxx/very-mount/linuxServer /home/kono707da/nas-mount
  3. 输入账密

  4. 配置开机自启

    1. 修改use_locks

      sudo vim /etc/davfs2/davfs2.conf 
      

      # use_locks 1改为use_locks 0

    2. 修改secrets文件,添加账号信息

      vim /etc/davfs2/secrets
      
    3. 文件底部添加账号信息

      http://192.168.3.2:5005/185xxxx/very-mount/linuxServer myAccount myPassword
      
    4. 配置rc-local

      1. 检查rc-local状态

        sudo systemctl status rc-local
        

        可能的报错:

        ● rc-local.service - /etc/rc.local CompatibilityLoaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)Drop-In: /lib/systemd/system/rc-local.service.d└─debian.confActive: failed (Result: exit-code) since Thu 2018-11-01 10:56:36 CST; 1h 59min agoDocs: man:systemd-rc-local-generator(8)Process: 1961 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)11月 01 10:56:36 ubuntu systemd[1]: Starting /etc/rc.local Compatibility...
        11月 01 10:56:36 ubuntu systemd[1961]: rc-local.service: Failed to execute command: Exec format error
        11月 01 10:56:36 ubuntu systemd[1961]: rc-local.service: Failed at step EXEC spawning /etc/rc.local: Exec format e
        11月 01 10:56:36 ubuntu systemd[1]: rc-local.service: Control process exited, code=exited status=203
        11月 01 10:56:36 ubuntu systemd[1]: rc-local.service: Failed with result 'exit-code'.
        11月 01 10:56:36 ubuntu systemd[1]: Failed to start /etc/rc.local Compatibility.
        
      2. 尝试开启rc-local

        sudo systemctl enable rc-local
        

        可能的报错:

        xugaoxiang@ubuntu:~$ sudo systemctl enable rc-local
        The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
        settings in the [Install] section, and DefaultInstance for template units).
        This means they are not meant to be enabled using systemctl.
        Possible reasons for having this kind of units are:
        1) A unit may be statically enabled by being symlinked from another unit's.wants/ or .requires/ directory.
        2) A unit's purpose may be to act as a helper for some other unit which hasa requirement dependency on it.
        3) A unit may be started when needed via activation (socket, path, timer,D-Bus, udev, scripted systemctl call, ...).
        4) In case of template units, the unit is meant to be enabled with someinstance name specified.
        
      3. 修复问题:The unit files have no installation config

        复制一份rc-local文件到目标目录

        sudo cp /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
        

        修改rc-local.service文件,加入[Install]的内容

        #  SPDX-License-Identifier: LGPL-2.1+
        #
        #  This file is part of systemd.
        #
        #  systemd is free software; you can redistribute it and/or modify it
        #  under the terms of the GNU Lesser General Public License as published by
        #  the Free Software Foundation; either version 2.1 of the License, or
        #  (at your option) any later version.# This unit gets pulled automatically into multi-user.target by
        # systemd-rc-local-generator if /etc/rc.local is executable.
        [Unit]
        Description=/etc/rc.local Compatibility
        Documentation=man:systemd-rc-local-generator(8)
        ConditionFileIsExecutable=/etc/rc.local
        After=network.target[Service]
        Type=forking
        ExecStart=/etc/rc.local start
        TimeoutSec=0
        RemainAfterExit=yes
        GuessMainPID=no[Install]
        WantedBy=multi-user.target
        
    5. 创建/etc/rc.local文件,输入开机运行脚本

      #!/bin/bashmount -t davfs http://192.168.3.2:5005/185xxxx/very-mount/linuxServer /home/kono707da/nas-mount
    6. 重启即可自动挂载。

  5. 测试

    输入df -h检查服务是否自启动

    在这里插入图片描述


http://www.ppmy.cn/devtools/39721.html

相关文章

BroadcastChannel:跨标签页通信

目前浏览器跨标签页通信的方式有很多,比如:websocket、针对LocalStorage使用window.onstorage、window.postmessage。 本文将用BroadcastChannel实现同一域名下两个标签页间消息的收和发 一、全局创建通信通道 const channel new BroadcastChannel(cha…

浅谈消息队列和云存储

1970年代末,消息系统用于管理多主机的打印作业,这种削峰解耦的能力逐渐被标准化为“点对点模型”和稍复杂的“发布订阅模型”,实现了数据处理的分布式协同。随着时代的发展,Kafka,Amazon SQS,RocketMQ&…

Web APIs - 第1天笔记

了解 DOM 的结构并掌握其基本的操作,体验 DOM 的在开发中的作用 知道 ECMAScript 与 JavaScript 的关系 了解 DOM 的相关概念及DOM 的本质是一个对象 掌握查找节点的基本方法 掌握节点属性和文本的操作 能够使用间歇函数创建定时任务 介绍 知道 ECMAScript 与…

OceanBase学习1:分布式数据库与集中式数据库的差异

目录 1. 传统集中式数据库 2. 数据库中间件的分库分表 3. 分布式数据库的基本特点及对比分析 4. OceanBase和传统数据库的对比 5. 小结 1. 传统集中式数据库 优点 成熟稳定:经过近40年的发展,应用到各行各业,产品技术非常成熟稳定行业适配性强:适配…

信息系统架构模型_3.企业数据交换总线

1.企业数据交换总线 实践中,还有一种较常用的架构,即企业数据交换总线,即不同的企业应用之间进行信息交换的公共通道,如图1所示。 图1 企业数据交换总线架构 这种架构在大型企业不同应用系统进行信息交换时使用较普遍&am…

Redis 实战之对象

Redis 实战 - 对象 对象的类型与编码类型编码和底层实现 字符串对象编码的转换字符串命令的实现 列表对象编码转换列表命令的实现 哈希对象编码转换哈希命令的实现 集合对象集合命令的实现 有序集合对象编码的转换有序集合命令的实现 类型检查与命令多态类型检查的实现多态命令…

RabbitMQ(安装配置以及与SpringBoot整合)

文章目录 1.基本介绍2.Linux下安装配置RabbitMQ1.安装erlang环境1.将文件上传到/opt目录下2.进入/opt目录下,然后安装 2.安装RabbitMQ1.进入/opt目录,安装所需依赖2.安装MQ 3.基本配置1.启动MQ2.查看MQ状态3.安装web管理插件4.安装web管理插件超时的解决…

VueComponent构造函数

//创建school组件——注册给谁 在谁的结构上写const school Vue.extend({name: school,//开发者工具的显示template: <div><h2>学校名称&#xff1a;{{schoolName}}</h2><h2>学校地址&#xff1a;{{adress}}</h2> </div>,//结构data() {…