{"id":114,"date":"2016-09-03T01:22:57","date_gmt":"2016-09-03T05:22:57","guid":{"rendered":"https:\/\/fs.wp.odu.edu\/sobrien\/?p=114"},"modified":"2016-12-02T21:39:04","modified_gmt":"2016-12-03T01:39:04","slug":"connecting-an-ubuntu-16-04-client-to-an-old-school-nis-server","status":"publish","type":"post","link":"https:\/\/fs.wp.odu.edu\/sobrien\/2016\/09\/03\/connecting-an-ubuntu-16-04-client-to-an-old-school-nis-server\/","title":{"rendered":"Connecting an Ubuntu 16.04 client to an old-school NIS server"},"content":{"rendered":"<p>This is a legacy process, and should be replaced with a different process, using LDAP or something, in new installations. However, if you are working in a legacy environment, this should do the trick for relatively sane installations of NIS and new Ubuntu installations.<\/p>\n<p>The NIS\u00a0domainname\u00a0is\u00a0<b>nisDomain<\/b>. Please note that in the context of NIS databases, &#8220;domainname&#8221; is an arbitrary string (you just pick one) and has nothing to do with your canonical domain name in DNS. [in other words, replace\u00a0<strong>nisDomain<\/strong> with your local NIS domain].<\/p>\n<p><b>Server Configuration<\/b><\/p>\n<p>Remember, please, to copy the database files before you edit them so that if you bork up royally, you can just go back easily. Use git, use cp, who cares, just make sure you have a known sane version to go back to quickly.<\/p>\n<p>In order to add the client to the NIS database you, need to log into\u00a0<b>nisServer<\/b>\u00a0and edit the following files:<\/p>\n<ul>\n<li class=\"li1\">\/etc\/yp\/<b>ethers<\/b><\/li>\n<li class=\"li1\">\/etc\/yp\/<b>netgroup<\/b><\/li>\n<li class=\"li1\">\/etc\/yp\/<b>hosts<\/b><\/li>\n<\/ul>\n<p>In\u00a0<b>ethers<\/b>, you need to add the MAC (Ethernet) address. Get this information from the client machine by running\u00a0<b>ifconfig<\/b>.<br \/>\nIn\u00a0<b>netgroup<\/b>, you need to add the client machine&#8217;s name.<br \/>\nIn\u00a0<b>hosts<\/b>, you need to add the IPv4 address and its name. Note that the IP address is assigned automatically via DHCP, and they are fairly static, but could change at any time.<\/p>\n<p>Once that is done you need to:<\/p>\n<p><code><b>cd \/var\/yp<\/b><br \/>\n<b>sudo make<\/b><\/code><\/p>\n<p>in order to rebuild the NIS database.<br \/>\nYou shouldn&#8217;t need to do a\u00a0<b>service nis restart<\/b>. You shouldn&#8217;t need to do a\u00a0<b>service ypbind restart<\/b>.<\/p>\n<p class=\"p2\"><b>Client Configuration<\/b><\/p>\n<p>If you&#8217;re going to do this to more than one machine, configure it then clone it. Get it right once and use copies somehow, with whatever technology you usually use.<\/p>\n<p>This article assumes that client machines should run an up-to-date installation of Ubuntu 16.04 LTS (Xenial Xerus). Please consider\u00a0<b>unattended-upgrades<\/b>. Also, conventional wisdom states that you should have at least one local user on the machine.<\/p>\n<p>Add<b>\u00a0nisServer<\/b>\u00a0to \/etc\/hosts, just for sanity:<br \/>\nFile:\u00a0<b>\/etc\/hosts<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>127.0.0.1 localhost<br \/>\n192.168.1.X clientName<br \/>\n192.168.1.Y nisServer<\/code><\/p>\n<p>Install the programs the client machine needs:<br \/>\n<b>sudo apt install nis rpcbind nfs-common<\/b>.<br \/>\nUpon installation you will be asked the NIS domainname, here\u00a0<b>nisDomain.<\/b><br \/>\nAdd nisServers&#8217;s IP to \/etc\/yp.conf:<br \/>\nFile: <b>\/etc\/yp.conf<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>ypserver 192.168.1.Y<\/code><\/p>\n<p>Explicitly set rpcbind as allowed over network:<br \/>\nFile:\u00a0<b>\/etc\/hosts.allow<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>rpcbind: \u00a0 \u00a0 \u00a0 127.0.0.1<br \/>\nrpcbind: \u00a0 \u00a0 \u00a0 192.168.1.Y<\/code><\/p>\n<p>Tell the client that NIS databases are available, and to query them first for the following categories by editing nsswitch. Note that there order of placement here matters; we have had anomalous permissions behavior if\u00a0<b>files<\/b>\u00a0precedes\u00a0<b>nis<\/b>\u00a0in some cases.<br \/>\nFile:\u00a0<b>\/etc\/nsswitch.conf<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>passwd: \u00a0 \u00a0 \u00a0 \u00a0 nis files<br \/>\ngroup: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0nis files<br \/>\nshadow: \u00a0 \u00a0 \u00a0 \u00a0 nis files<br \/>\nhosts: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0nis files mdns4_minimal [NOTFOUND=return] dns<br \/>\nnetworks: \u00a0 \u00a0 \u00a0 nis files<br \/>\nprotocols: \u00a0 \u00a0 \u00a0db files nis<br \/>\nservices: \u00a0 \u00a0 \u00a0 db files nis<br \/>\nethers: \u00a0 \u00a0 \u00a0 \u00a0 db files nis<br \/>\nrpc: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0db files nis<br \/>\nnetgroup: \u00a0 \u00a0 \u00a0 nis<br \/>\npublickey: \u00a0 \u00a0 \u00a0nis<br \/>\nautomount: \u00a0 \u00a0 \u00a0nis<br \/>\naliases: \u00a0 \u00a0 \u00a0 \u00a0nis<\/code><\/p>\n<p>Ensure\u00a0portmap starts on boot by adding\u00a0<b>service\u00a0portmap start\u00a0<\/b>to \/etc\/rc.local:<br \/>\nFile:\u00a0<b>\/etc\/rc.local<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>#!\/bin\/sh -e<br \/>\n#<br \/>\n# rc.local<br \/>\n#<br \/>\n# This script is executed at the end of each multiuser runlevel.<br \/>\n# Make sure that the script will \"exit 0\" on success or any other<br \/>\n# value on error.<br \/>\n#<br \/>\n# In order to enable or disable this script just change the execution<br \/>\n# bits.<br \/>\n#<br \/>\n# By default this script does nothing.<br \/>\nservice portmap start<br \/>\nexit 0<\/code><\/p>\n<p>You need to run\u00a0<b>update-rc.d nis defaults\u00a0<\/b>to install\u00a0<b>nis\u00a0<\/b>services at\u00a0boot time, however, note that the default script links the boot script as\u00a0<b>S01nis<\/b>\u00a0in\u00a0<b>\/etc\/rc5.d<\/b>, so if you find that nis is failing after boot, defaults may not be sufficient and you can try again with a higher S number.<\/p>\n<p>You could put your NFS shares in <strong>\/etc\/fstab<\/strong>. Or you could\u00a0<b>sudo apt install autofs<\/b><br \/>\nAutofs is the file system service that mounts the user&#8217;s home directory via NFS when the directory is needed, including at login. In order to configure it, you need to edit the following files:<br \/>\nFile:\u00a0<b>\/etc\/auto.master<\/b><\/p>\n<p style=\"padding-left: 30px\"><code># This is a 'master' automounter map and it has the following format:<br \/>\n# mount-point [map-type[,format]:]map [options]<br \/>\n# For details of the format look at auto.master(5).<br \/>\n#<br \/>\n\/misc \u00a0 \/etc\/auto.misc<br \/>\n\/home \u00a0 \/etc\/auto.home<br \/>\n#<br \/>\n# NOTE: mounts done from a hosts map will be mounted with the<br \/>\n# \u00a0 \u00a0 \u00a0 \"nosuid\" and \"nodev\" options unless the \"suid\" and \"dev\"<br \/>\n# \u00a0 \u00a0 \u00a0 options are explicitly given.<br \/>\n#<br \/>\n#\/net \u00a0 -hosts<br \/>\n\/net \u00a0 yp \u00a0 \u00a0 <a href=\"http:\/\/auto.net\/\">auto.net<\/a><br \/>\n#<br \/>\n# Include \/etc\/auto.master.d\/*.autofs<br \/>\n# The included files must conform to the format of this file.<br \/>\n#<br \/>\n+dir:\/etc\/auto.master.d<br \/>\n#<br \/>\n# Include central master map if it can be found using<br \/>\n# nsswitch sources.<br \/>\n#<br \/>\n# Note that if there are entries for \/net or \/misc (as<br \/>\n# above) in the included master map any keys that are the<br \/>\n# same will not be seen as the first read key seen takes<br \/>\n# precedence.<br \/>\n#<br \/>\n+auto.master<\/code><\/p>\n<p>File:\u00a0<b>\/etc\/auto.home<\/b><\/p>\n<p style=\"padding-left: 30px\"><code># This is the trad way<br \/>\n* \u00a0 \u00a0 nisServer:\/home\/&amp;<br \/>\n#<br \/>\n# This is a way to do it by pulling a file from your nis directory on server<br \/>\n+auto.home<\/code><\/p>\n<p>Note that <strong>+auto.home<\/strong> is a pointer reference to the\u00a0<b>\/etc\/yp\/auto.home<\/b> (or something similar)\u00a0file on\u00a0your <b>nisServer.<\/b><\/p>\n<p>Lastly, we have to configure<b>\u00a0lightdm<\/b>, Ubuntu&#8217;s graphical login client. First, you have to enable manual logins via username. Second, there&#8217;s an is apparently an issue with some default sessions for some users, for some reason; at times, if the default session isn&#8217;t explicitly set, it borks. Anyway, it&#8217;s an easy fix. Create a local configuration by creating a conf file in the appropriate directory. Call it <strong>nis.conf<\/strong> or so. Basically lightdm will load\u00a0<b>*.conf<\/b>\u00a0in this dir when it runs, so you can call it anything. (This is debian convention.) This file has no man page, but googling around and trying variants helped. There&#8217;s a sample of the file (with syntax) at\u00a0\/usr\/share\/doc\/lightdm\/lightdm.conf.gz. Anyway, create this:<br \/>\nFile:\u00a0<b>\/etc\/lightdm\/lightdm.conf.d\/nis.conf<\/b><\/p>\n<p style=\"padding-left: 30px\"><code>[SeatDefaults]<br \/>\ngreeter-show-manual-login=true<br \/>\nuser-session=true<\/code><\/p>\n<p><i>At this point, the client&#8217;s configuration is done.<\/i> The client knows the server is there, and the server knows the client exists, so you should be able to log in with your <strong>nisServer<\/strong>\u00a0credentials.<\/p>\n<p>You need to\u00a0<b>sudo reboot<\/b>\u00a0to restart the client machine, ensure it brings the services up properly on every reboot, and log in to test it, preferably with more than one user.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a legacy process, and should be replaced with a different process, using LDAP or something, in new installations. However, if you are working in a legacy environment, this should do the trick for relatively sane installations of NIS and new Ubuntu installations. The NIS\u00a0domainname\u00a0is\u00a0nisDomain. Please note that in the context of NIS databases, [&hellip;]<\/p>\n","protected":false},"author":3412,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","wds_primary_category":0},"categories":[5,19,18,16],"tags":[],"_links":{"self":[{"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/posts\/114"}],"collection":[{"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/users\/3412"}],"replies":[{"embeddable":true,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":5,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/posts\/114\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fs.wp.odu.edu\/sobrien\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}