How I now configure the name switch in Solaris 11

/etc/nsswitch.conf is dead in S11. What I use now to configure the name switch is the following shell script which can take either a nis or ldap argument:

#!/bin/ksh -p

# New way of configuing the name switch.  nsswitch.conf is dead in S11 so the
# following must be edited and run instead of editing that nsswitch.conf.

me=${0##*/}
tmpfile=$(/usr/bin/mktemp -t ${me}.XXXXXX)

case $1 in
	'nis')
cat > $tmpfile <<EOF 
setprop config/password = astring: "files nis [TRYAGAIN=0 UNAVAIL=return NOTFOUND=return]"
setprop config/group =    astring: "files nis [TRYAGAIN=0 UNAVAIL=return NOTFOUND=return]"
setprop config/host =     astring: "files dns"
setprop config/network =  astring: files
setprop config/protocol = astring: files
setprop config/rpc =      astring: files
setprop config/ether =    astring:   files
setprop config/netmask =  astring:   files
setprop config/bootparam = astring:  files
setprop config/publickey = astring:  files
setprop config/netgroup =  astring:  nis
setprop config/automount = astring:  "files nis"
setprop config/alias =     astring:  files
setprop config/service =   astring:  files
setprop config/printer = astring:    "user files"
setprop config/project = astring:    files
setprop config/auth_attr = astring:  files
setprop config/prof_attr = astring:  files
setprop config/tnrhtp = astring:     files
setprop config/tnrhdb = astring:     files
exit
EOF
	;;

	'ldap')
cat > $tmpfile <<EOF 
setprop config/password = astring: "files ldap"
setprop config/group =    astring: "files ldap"
setprop config/host =     astring: "files dns"
setprop config/network =  astring: files
setprop config/protocol = astring: files
setprop config/rpc =      astring: files
setprop config/ether =    astring:   files
setprop config/netmask =  astring:   files
setprop config/bootparam = astring:  files
setprop config/publickey = astring:  files
setprop config/netgroup =  astring:  ldap
setprop config/automount = astring:  "files ldap"
setprop config/alias =     astring:  files
setprop config/service =   astring:  files
setprop config/printer = astring:    "user files ldap"
setprop config/project = astring:    files
setprop config/auth_attr = astring:  files
setprop config/prof_attr = astring:  files
setprop config/tnrhtp = astring:     files
setprop config/tnrhdb = astring:     files
exit
EOF
	;;
esac

svccfg -s svc:/system/name-service/switch -f $tmpfile || exit
rm $tmpfile
svcadm refresh svc:/system/name-service/switch:default
print "Current svc:/system/name-service/switch config:"
svccfg -s svc:/system/name-service/switch listprop 'config/*'
Comments:

Post a Comment:
Comments are closed for this entry.
About

user12615206

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today