0158.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Add Debian/Ubuntu Linux Device to Windows Active Directory</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="How To Join Linux To Domain,How To Join Linux To Windows Active Directory,Windows,Active Directory,Linux,Ubuntu,Debian,Authentication,Home Lab,Self-Hosted,AD,Administration,Active Directory Management,Active Directory Administration,Windows Administration,System Administrator,Self-hosted,Network,Microsoft Windows,Microsoft,LDAP,Lightweight Directory Access Protocol,Install Guide,Home Networking,Domain,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Add Debian/Ubuntu Linux Device to Windows Active Directory">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="05/04/2022 10:09:24 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Add Debian/Ubuntu Linux Device to Windows Active Directory</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>Installing Pre-Requesites and Configuration</h2>
  26. <ol>
  27. <li>Log into the Debian device and run the following commands in terminal:
  28. <div class="codeBlock">sudo apt update<br />
  29. # set the fully qualified host name<br />
  30. sudo hostnamectl set-hostname nettools.i12bretro.local<br />
  31. # confirm or add domain controller to DNS entries<br />
  32. sudo nano /etc/resolv.conf<br />
  33. sudo systemctl disable systemd-resolved<br />
  34. sudo systemctl stop systemd-resolved<br />
  35. sudo apt-get upgrade<br />
  36. # install required packages<br />
  37. sudo apt -y install realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit<br />
  38. sudo realm discover i12bretro.local</div>
  39. </li>
  40. <li>Paste the following text into /etc/krb5.conf
  41. <p>[libdefaults]<br />
  42. dns_lookup_realm = false<br />
  43. ticket_lifetime = 24h<br />
  44. renew_lifetime = 7d<br />
  45. forwardable = true<br />
  46. rdns = false<br />
  47. default_realm = I12BRETRO.LOCAL<br />
  48. default_ccache_name = KEYRING:persistent:%{uid}</p>
  49. </li>
  50. <li>Press CTRL+O, Enter, CTRL+X to write the changes to /etc/krb5.conf</li>
  51. <li>Continue with the following commands in terminal:
  52. <div class="codeBlock">sudo realm join -U i12bretro i12bretro.local<br />
  53. # check the configured value of the domain<br />
  54. sudo realm list</div>
  55. </li>
  56. <li>Paste the following lines into terminal together to enable automatically creating user home directories:
  57. <p>sudo bash -c &quot;cat &gt; /usr/share/pam-configs/mkhomedir&quot; &lt;&lt;EOF Name: activate mkhomedir<br />
  58. Default: yes<br />
  59. Priority: 900<br />
  60. Session-Type: Additional<br />
  61. Session:<br />
  62. required pam_mkhomedir.so umask=0022 skel=/etc/skel<br />
  63. EOF</p>
  64. </li>
  65. <li>Continue with the following commands in terminal:
  66. <div class="codeBlock">sudo pam-auth-update</div>
  67. </li>
  68. <li>Arrow down to activate mkhomedir &gt; Press spacebar to select &gt; Press Enter to confirm</li>
  69. <li>Run one or more of the following commands in terminal to grant active directory users or groups access to log into the linux machine:
  70. <div class="codeBlock"># add specific user(s )<br />
  71. realm permit user1@i12bretro.local user2@i12bretro.local<br />
  72. # add specific group(s)<br />
  73. sudo realm permit -g &#39;LinuxUsers&#39; &#39;Linux Admins&#39;<br />
  74. # add everyone<br />
  75. sudo realm permit --all<br />
  76. # deny everyone<br />
  77. sudo realm deny --all</div>
  78. </li>
  79. <li>Similarly, run the following command to edit /etc/sudoers.d/domain_admins to add specific users or groups to the sudoers file:
  80. <div class="codeBlock">sudo nano /etc/sudoers.d/domain_admins<br />
  81. # add specific user(s )<br />
  82. user1@i12bretro.local ALL=(ALL) ALL<br />
  83. user2@i12bretro.local ALL=(ALL) ALL<br />
  84. # add specific group(s)<br />
  85. %LinuxUsers@i12bretro.local ALL=(ALL) ALL<br />
  86. %Linux\ Admins@i12bretro.local ALL=(ALL) ALL</div>
  87. </li>
  88. <li>Press CTRL+O, Enter, CTRL+X to write the changes to /etc/sudoers.d/domain_admins</li>
  89. </ol>
  90. <h2>Testing Active Directory Authentication</h2>
  91. <ol>
  92. <li>Attempt to login to the Debian device either into a desktop environment or via SSH. The user name must be formatted like user1@i12bretro.local and the password will be the active directory password</li>
  93. </ol>
  94. <p>Additonal reading: <a href="https://computingforgeeks.com/join-ubuntu-debian-to-active-directory-ad-domain/" target="_blank">https://computingforgeeks.com/join-ubuntu-debian-to-active-directory-ad-domain/</a></p>
  95. </div>
  96. </div>
  97. </body>
  98. </html>