mount.smbfs

来自「Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分」· SMBFS 代码 · 共 69 行

SMBFS
69
字号
#!/bin/csh## /sbin/mount.smbfs# by Greg Galperin, MAR99 <grg@ai.mit.edu># ver 1.1 MAR99	GRG	docs update: must escape special chars like $# ver 1.0 MAR99	GRG	original version## Intent is to allow calls to mount with -t smbfs to work properly# (either manually or from an automounter).## bugs:#  -- possible security hole, as this is a shell script called as root...#  -- arguments other than rw and ro which mount might supply are not handled# ############################################################################# To use this from autofs:## have an entry of the form#	key	-fstype=smbfs,-Uadministrator,-Ppassword	://host/share# in the appropriate /etc/auto.mountpoint file.## This makes access to /mountpoint/key/ access smb //host/share/ # as administrator (or another user, if you specify such) with the given# password.  You may have to supply a -c <unqualified-localhostname>.# Special characters need to be 'escaped' with a backslash ('\') -- for # instance, if you want to use the default share names with a "$" at the # end (e.g., //host/c$), you must enter ://host/c\$ ## Note that mount/autofs is smart enough to figure out how to unmount# this without any extra work on our part!############################################################################## I get called as: /sbin/mount.smbfs //host/shr /mnt/tmp -o rw,arg1,arg2## It looks like mount tacks on either "rw" or "ro" as the first argument,# so I'm going to count on having exactly 5 arguments.## This has been developed and tested with mount-2.7############################################################################# test for correct # argsif ( $# != 4 ) then    echo $0 does not know how to handle $# arguments: $*    exit -1endif# test for args in the form I expectif ( "$3" != "-o" ) then    echo $0 does not know how to handle the 3rd argument not \"-o\" : $3    exit -1endifsetenv COMMAND "/usr/sbin/smbmount $1 $2"foreach arg (`echo $4 | /usr/bin/tr ',' ' '`)    if ( "$arg" == "rw" ) then	setenv COMMAND "$COMMAND -f777 -d777"    else if ( "$arg" == "ro" ) then	setenv COMMAND "$COMMAND -f555 -d555"    else	setenv COMMAND "$COMMAND $arg"    endifend$COMMAND

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?