redhat – 使用autofs挂载CIFS共享
发布时间:2020-05-24 02:47:06 所属栏目:Linux 来源:互联网
导读:我有一个运行RHEL 5.5的系统,我正在尝试使用autofs在服务器上安装 Windows共享. (由于网络在启动时没有准备好,我不想使用fstab.)我可以手动挂载共享,但autofs只是没有安装它们. 以下是我正在使用的文件: 在/etc/auto.master结束时,我有: ## Mount this test
|
我有一个运行RHEL 5.5的系统,我正在尝试使用autofs在服务器上安装 Windows共享. (由于网络在启动时没有准备好,我不想使用fstab.)我可以手动挂载共享,但autofs只是没有安装它们. 以下是我正在使用的文件: 在/etc/auto.master结束时,我有: ## Mount this test share: /test /etc/auto.test --timeout=60 在/etc/auto.test中,我有: test -fstype=cifs,username=testuser,domain=domain.com,password=password ://server/test 然后我重新启动autofs服务. 但是,这不起作用.对目录不会返回任何结果.我已经在网上关注了所有这些指南,我要么不理解它们,要么就是他们.just.don’t.work. 谢谢 解决方法应该有一个/etc/auto.smb,使用它,并将以下行添加到/etc/auto.master:/cifs /etc/auto.smb --timeout=60 现在所有的cifs股票都将显示在/ cifs下: ls /cifs/<server> 将显示所有可用的股票.您可能希望在/etc/auto.smb中添加一些选项以使用特定模式进行安装.我有一个auto.smb,我在那里发现并修改,以做到这一点: #!/bin/bash
# $Id: auto.smb,v 1.3 2005/04/05 13:02:09 raven Exp $
# This file must be executable to work! chmod 755!
key="$1"
credfile="/etc/auto.smb.$key"
opts="-fstype=cifs,file_mode=0644,dir_mode=0755,uid=eng,gid=eng"
smbclientopts=""
for P in /bin /sbin /usr/bin /usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done
[ -x $SMBCLIENT ] || exit 1
if [ -e "$credfile" ]
then
opts=$opts",credentials=$credfile"
smbclientopts="-A "$credfile
else
smbclientopts="-N"
fi
$SMBCLIENT $smbclientopts -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- '
BEGIN { ORS=""; first=1 }
/Disk/ {
if (first)
print opts; first=0
dir = $2
loc = $2
# Enclose mount dir and location in quotes
# Double quote "$" in location as it is special
gsub(/$$/,"$",loc);
print " nt "/" dir """,""://" key "/" loc """
}
END { if (!first) print "n"; else exit 1 }
'
这将做你想要的.我自己用过它. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
