mount_smbfs 在 crontab 中失败 "mount_smbfs: unable to open connection: syserr = Authentication error"

mount_smbfs fails in crontab with "mount_smbfs: unable to open connection: syserr = Authentication error"

我希望 FreeBSD 机器在启动后自动从 Linux 服务器挂载 SMB 共享。因此,我在根 crontab 中写了一个脚本 运行 来挂载它。我已经在 /root/.nsmbrc 和脚本 运行s 上设置了需要的凭据和 IP,在命令行上很好。但是,从 crontab 调用时失败并出现以下错误。

mount_smbfs: unable to open connection: syserr = Authentication error

文件内容/root/.nsmbrc

[default]
workgroup=WORKGROUP

[UBUNTU]
addr=192.168.1.20
charsets=UTF-8:UTF-8

[UBUNTU:FREEBSD]
password=f(Xc4CVfx4HU7;9

安装线

/usr/sbin/mount_smbfs -N -f 666 -d 777 //freebsd@ubuntu/share /net/ubuntu/share

我该如何解决?

非常感谢!

尝试 /etc/fstab,例如:

//u123@u123/foo /mnt/foo smbfs rw,late,-N 0 0

If the option "late" is specified, the file system will be automatically mounted at a stage of system startup after remote mount points are mounted. (man fstab)

然后在 /etc/nsmb.conf 你可以有类似的东西:

[U123]
addr=192.168.1.20
retry_count=100
timeout=30
[U123:U123]
password=secret