如何在 /etc/fstab 中为 Windows 共享添加条目?

Jos*_*osh 8 networking mount fstab

我希望能够在我的 Ubuntu 10.10 linux 笔记本电脑上挂载我们文件服务器的文件共享(在 Mac OS X 服务器上,通过 AFP 和 Windows 文件共享共享)。我希望能够以我的普通用户身份安装它,并且每次都被提示输入密码。我要添加什么/etc/fstab来实现这一点?我知道我以前做过,但我现在忘记了怎么做。

编辑:有问题的共享称为“G4 320”,我正在 fstab 中尝试以下行:

//server_ip/G4\040320    /media/G4/    cifs    user,username=something    0    0
Run Code Online (Sandbox Code Playgroud)

但我通过以下方式获得以下信息dmesg

CIFS VFS:cifs_mount 失败,返回代码 = -6

编辑2:

根据要求,提供更多调试信息。dmesg我的 fstab 行的输出:

[151994.740138] CIFS VFS: cifs_mount failed w/return code = -6
[152007.760136] CIFS VFS: cifs_mount failed w/return code = -6
[152132.770147] CIFS VFS: cifs_mount failed w/return code = -6
[152221.700152] CIFS VFS: cifs_mount failed w/return code = -6
[152245.340132] CIFS VFS: cifs_mount failed w/return code = -6
Run Code Online (Sandbox Code Playgroud)

输出来自迈克尔dmesgcredentials行:

[153117.088656] CIFS VFS: No username specified
[153117.088668] CIFS VFS: cifs_mount failed w/return code = -22
[153164.358300] CIFS VFS: No username specified
[153164.358312] CIFS VFS: cifs_mount failed w/return code = -22
Run Code Online (Sandbox Code Playgroud)

/var/log/messages 似乎没有有用的信息。

编辑3:好的。再次感谢迈克尔我几乎拥有它!如果我输入以下内容,/etc/fstab则它可以工作:

//10.1.0.15/G4\040320H  /media/G4       cifs    user=AzureDiamond,password=hunter2       0       0
Run Code Online (Sandbox Code Playgroud)

然而:

  1. 我不想我的密码在那里...
  2. 我现在需要使用sudo来挂载共享。

我该如何解决这两个问题?

Jos*_*osh 4

我最终使用的行/etc/fstab是:

//10.1.0.15/G4\040320H   /media/G4   cifs   username=master,user   0   0
Run Code Online (Sandbox Code Playgroud)

解决不提示输入密码以及credentials=无法工作的问题的方法是通过以下方式安装mount.cifs

sudo apt-get install cifs-utils
Run Code Online (Sandbox Code Playgroud)

就像 Michael Mrozek 一样,我假设我已经mount.cifs安装了,否则我将无法挂载 CIFS 共享,但显然内核将使用它自己的内部代码来挂载,除非它发现mount.cifs