AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1257914
Accepted
Muadib
Muadib
Asked: 2020-07-11 00:44:12 +0800 CST2020-07-11 00:44:12 +0800 CST 2020-07-11 00:44:12 +0800 CST

Autofs 在 Ubuntu 18.04 中不显示 Samba 目录的文件

  • 772

我一直在尝试让 AutoFS 在我的家庭网络//content/projects中本地安装一个位置,/mnt/content但在那里导航时没有文件。

如果我通过 fstab 挂载,没有问题,这工作正常:

//content/projects  /mnt/content/  cifs  credentials=/etc/creds/content,uid=localuser,rw 0 0

所以我在 /etc/auto.master 添加了一行:

/mnt/content /etc/auto.cifs-shares --timeout 300

然后在“auto.cifs-shares”中:

projects --fstype=cifs,credentials=/etc/creds/content,dir_mode=0755,file_mode=0755,uid=user,rw ://content/projects

编辑了我的 /etc/creds/content 文件:

username=smbuser
password=smbpass

最后通过“ sudo automount -f -v ”在shell中重新启动autofs :

$ sudo automount -f -v
Starting automounter version 5.1.2, master map /etc/auto.master
using kernel protocol version 5.02
lookup(dir): dir map /etc/auto.master.d missing or not readable
lookup(file): failed to read included master map dir:/etc/auto.master.d
lookup(file): failed to read included master map auto.master
mounted indirect on /mnt/content with timeout 300, freq 75 seconds

然而,'ls /mnt/content/' 显示一个空目录。

我在这里想念什么?

提前致谢!

samba sharing 18.04 autofs
  • 1 1 个回答
  • 800 Views

1 个回答

  • Voted
  1. Best Answer
    Morbius1
    2020-07-11T04:03:10+08:002020-07-11T04:03:10+08:00

    我设法通过替换您帖子中可能存在的拼写错误来完成这项工作:

    在 auto.master 中:

    /mnt/content /etc/auto.cifs-shares --timeout=300 --ghost
    

    我在超时和 300 之间添加了一个 =,并且我添加了 --ghost

    在 /etc/auto.cifs-shares

    projects -fstype=cifs,credentials=/etc/creds/content,dir_mode=0755,file_mode=0755,uid=user,rw ://content/projects
    

    我用 -fstype=cifs 替换了 --fstype=cifs

    附带说明:如果您有兴趣,systemd 有自己的 autofs 版本。它通过 fstab 工作。基于您的 fstab 语句的等效项如下所示:

    //content/projects  /mnt/content/  cifs  credentials=/etc/creds/content,uid=localuser,rw,noauto,x-systemd.automount,x-systemd.idle-timeout=300 0 0
    

    如果您想对此进行试验,您可能需要更改挂载点。不知道当您有两个 autofs 进程在同一个挂载点上同时运行时会发生什么。

    noauto,x-systemd.automount替换其中的“在我访问挂载点之前不要挂载共享”部分。

    x-systemd.idle-timeout=300替换 auto.master 中的 --timeout=300 部分。

    然后你需要重置systemd:

    sudo systemctl daemon-reload
    sudo systemctl restart remote-fs.target
    
    • 0

相关问题

  • 以root身份运行的Ubuntu Server samba?

  • 如何通过 Windows 网络共享文件?

  • 如何设置 Ubuntu Server 10.04 LTS 作为 samba 主域控制器使用 pam 模块对 LDAP 服务器进行身份验证?

  • 如何在 Ubuntu 中设置与 Windows 7 机器的打印机共享?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve