Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-27-2012, 04:00 PM   #1
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 430
Blog Entries: 30

Rep: Reputation: 2
autofs IS LYING! executable map doesnt work

Hi, I tried a few times, but it still doesn't work. I REALIZED autofs man is lying, and according to this webpage:
executable maps should work perfectly:
# This file must be executable to work! chmod 755!
# Note: this script works only in authentication free servers,
# if you want to add authentication please do.
# Ted wrote in 2012 Aug 28
# Note: Use cifs:

output="$(/usr/bin/smbclient -N -L //$key -g 2>&1)"
for each in ${dirs[@]} ; do
	if [ "${each:0:4}" == "Disk" ] ; then
		printf "${dir[1]}\t$opts\t://$key/${dir[1]}\n"
This is my customized executable map chmod at 755
Where as:

# This file must be executable to work! chmod 755!


for P in /bin /sbin /usr/bin /usr/sbin
	if [ -x $P/smbclient ]

[ -x $SMBCLIENT ] || exit 1

$SMBCLIENT -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 " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
	END 	{ if (!first) print "\n"; else exit 1 }
was /etc/auto.smb a file that came with the system,the two outputs give the follow:
root:# /etc/auto.cifs NAS
root	-fstype=cifs,noperm,file_mode=0660,dir_mode=0755	://NAS/root
main	-fstype=cifs,noperm,file_mode=0660,dir_mode=0755	://NAS/main
downloads	-fstype=cifs,noperm,file_mode=0660,dir_mode=0755	://NAS/downloads
media	-fstype=cifs,noperm,file_mode=0660,dir_mode=0755	://NAS/media
stream	-fstype=cifs,noperm,file_mode=0660,dir_mode=0755	://NAS/stream
root:# /etc/auto.smb NAS
-fstype=cifs \
	 "/root" "://NAS/root" \
	 "/main" "://NAS/main" \
	 "/downloads" "://NAS/downloads" \
	 "/media" "://NAS/media" \
	 "/stream" "://NAS/stream"
I tried the output of my own customized script as unexecutable form, and works perfectly.
Here is the auto.master file:
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
/misc			/etc/auto.misc		--timeout=60
# NOTE: mounts done from a hosts map will be mounted with the
#	"nosuid" and "nodev" options unless the "suid" and "dev"
#	options are explicitly given.
/misc/net/NAS		/etc/auto.test		--timeout=60 //unexecutable customized script
/misc/net/NAS		/etc/auto.smb NAS		--timeout=60
/misc/net/NAS		/etc/auto.cifs NAS		--timeout=60
/misc/net/NAS		/etc/auto.smb		--timeout=60
# Include central master map if it can be found using
# nsswitch sources.
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
I have tried all combinations above separately, but none works. autofs is a big LIER.

Last edited by ted_chou12; 08-27-2012 at 04:02 PM.
Old 08-28-2012, 05:15 PM   #2
Registered: Sep 2003
Posts: 382

Rep: Reputation: 87
Hi ted_chou12!

In a different thread concerning autofs on I illustrated an executable map that's actually working on my system. Naturally, the implementation of autofs that you are using might work differently. The thread focused on other issues which don't seem to be things with which you are having problems. But you can look at how I set up the master map, and the executable map that actually worked on my system. Maybe that can help you. Here's a link to the particular message where I included the master map and an associated executable map that worked for me. The link should take you to message # 9 in that thread.

1 members found this post helpful.
Old 08-29-2012, 01:07 PM   #3
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 430

Original Poster
Blog Entries: 30

Rep: Reputation: 2
Thanks kakaka.
I got it to work today! The executable maps worked finally.
The auto.master file looks like this:
/net           /etc/auto.smb         timeout=......etc
auto.smb is right up there.
After restarting autofs.
You must manually access your directories. such as "ls /net/NAS". Notice the word manually, cause the machine will not search and list the avialable shares for you. But I can't get my other share for the host name TED-PC to work, my guess is that the "-" (dash) is causing the troubles. But I am not sure how to solve it.
I hope there is someone that could resolve this problem. But the issue regarding this thread is technically solved.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
autofs doesnt turn ghost option off ted_chou12 Linux - Software 0 08-27-2012 12:39 PM
[SOLVED] executable file apparently doesnt exist when trying to execute with bash archnemesis Linux - Newbie 2 05-09-2011 07:06 AM
Autofs Questions- options: map versus mount and time limit local dman777 Linux - Software 0 01-01-2011 03:22 PM
how to read shell variable in /etc/ map for autofs service UltraSoul Linux - General 8 06-05-2009 07:21 AM
autofs works, but doesnt show automounted directory nef Linux - Software 1 03-02-2005 07:12 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration