{"id":98,"date":"2024-06-17T09:00:50","date_gmt":"2024-06-17T14:00:50","guid":{"rendered":"https:\/\/it.blackcatsystems.org\/?p=98"},"modified":"2024-06-22T11:05:10","modified_gmt":"2024-06-22T16:05:10","slug":"joining-a-mint-linux-machine-to-the-domain-and-enabling-rdp","status":"publish","type":"post","link":"https:\/\/it.blackcatsystems.org\/index.php\/2024\/06\/17\/joining-a-mint-linux-machine-to-the-domain-and-enabling-rdp\/","title":{"rendered":"Joining a Mint Linux Machine to the Domain and Enabling RDP"},"content":{"rendered":"\n<p>This guide was one of several that was pieced together during our recent network overhaul and expansion project. It is intended for a Linux Mint 21.3 machine with the default Cinnamon desktop environment. You might have success with versions close to 21.3 or other desktop environments using this guide.<\/p>\n\n\n\n<p>Follow these detailed steps to join your Mint Linux machine to the domain and enable RDP functionality.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update and Install Necessary Software<\/h2>\n\n\n\n<p>First, update your system and install the required software, including SSH.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt upgrade -y\nsudo apt-get install -y openssh-server # OPTIONAL\nsudo reboot<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Required Packages and Prepare the System<\/h2>\n\n\n\n<p>Next, install the necessary packages for domain integration and configure some initial settings.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install realmd sssd sssd-tools samba-common krb5-user packagekit samba-common-bin samba-libs adcli lightdm-gtk-greeter libpam-mkhomedir xrdp xorgxrdp\n# You'll be prompted to enter your domain: YOURDOMAIN.COM\nsudo usermod -a -G ssl-cert xrdp\nsudo apt -y remove avahi-daemon\nsudo nano \/etc\/sudoers # OPTIONAL<\/code><\/pre>\n\n\n\n<p>OPTIONAL: If you&#8217;d like to add any users or groups to the sudo file, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>%myWorkstationAdmins ALL=(ALL) ALL\n%myDomainAdmins ALL=(ALL) ALL<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Configure Login Screen Integration<\/h2>\n\n\n\n<p>Update PAM configuration to create home directories automatically upon first login.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pam-auth-update --enable mkhomedir\nsudo nano \/etc\/pam.d\/common-session<\/code><\/pre>\n\n\n\n<p>Add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>session required pam_mkhomedir.so skel=\/etc\/skel\/ umask=0022<\/code><\/pre>\n\n\n\n<p>Update the LightDM PAM configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/pam.d\/lightdm<\/code><\/pre>\n\n\n\n<p>Replace the entire file with the following..<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/pam.d\/lightdm - PAM configuration for LightDM\n#%PAM-1.0\n# Prevent non-root users from login when \/etc\/nologin exists\nauth    requisite       pam_nologin.so\n# Allow users in the 'nopasswdlogin' group to bypass authentication\nauth    sufficient      pam_succeed_if.so user ingroup nopasswdlogin\n# Include common authentication settings\n@include common-auth\n# Optional support for GNOME and KDE keyrings\n-auth   optional        pam_gnome_keyring.so\n-auth   optional        pam_kwallet.so\n-auth   optional        pam_kwallet5.so\n\n# Include common account settings\n@include common-account\n\n# Include common session settings\nsession &#91;success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close\n#session required        pam_loginuid.so\nsession required        pam_limits.so\n@include common-session\nsession &#91;success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open\n-session optional        pam_gnome_keyring.so auto_start\n-session optional        pam_kwallet.so auto_start\n-session optional        pam_kwallet5.so auto_start\nsession required        pam_env.so readenv=1\nsession required        pam_env.so readenv=1 user_readenv=1 envfile=\/etc\/default\/locale\n\n# Include common password settings\n@include common-password\n\n# Allow users to be authenticated by SSSD\nauth    sufficient      pam_sss.so\n\n# Include common account settings again for pam_sss\naccount &#91;default=bad success=ok user_unknown=ignore] pam_sss.so\n\n# Include common session settings again for pam_sss\nsession optional        pam_sss.so\n\n# Include common password settings again for pam_sss\npassword sufficient     pam_sss.so<\/code><\/pre>\n\n\n\n<p>Update LightDM configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/lightdm\/lightdm.conf<\/code><\/pre>\n\n\n\n<p>Add the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Seat:*]\ngreeter-session=lightdm-gtk-greeter\nautologin-user-timeout=0\ngreeter-show-manual-login=true\ngreeter-hide-users=true<\/code><\/pre>\n\n\n\n<p>Update the LightDM greeter configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/pam.d\/lightdm-greeter<\/code><\/pre>\n\n\n\n<p>Add the following lines to the top of the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>auth    required    pam_permit.so\naccount required    pam_permit.so\nsession required    pam_permit.so<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Join the Domain and Configure SSSD<\/h2>\n\n\n\n<p>Configure DNS and host files for domain joining:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/resolv.conf<\/code><\/pre>\n\n\n\n<p>Replace the nameserver line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nameserver 192.168.0.5<\/code><\/pre>\n\n\n\n<p>Make the file immutable to prevent changes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chattr +i \/etc\/resolv.conf\nsudo nano \/etc\/hosts<\/code><\/pre>\n\n\n\n<p>Replace the second line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>192.168.0.25       mintMachine mintMachine.yourdomain.com<\/code><\/pre>\n\n\n\n<p>Add the domain controller to the hosts file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -i\nsudo echo 192.168.0.5 servername.yourdomain.com servername &gt;&gt; \/etc\/hosts<\/code><\/pre>\n\n\n\n<p><strong>Join the Domain<\/strong><\/p>\n\n\n\n<p>Discover and join the domain:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo realm discover yourdomain.com # TEST to see if the domain is visible\nsudo realm join --user=Administrator yourdomain.com\nsudo id myuser@yourdomain.com  # TEST to see if you can pull a user. If not, you may just need to reboot the machine.<\/code><\/pre>\n\n\n\n<p>Configure SSSD:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/sssd\/sssd.conf<\/code><\/pre>\n\n\n\n<p>Match the following configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;sssd]\ndomains = yourdomain.com\nconfig_file_version = 2\nservices = nss, pam\n\n&#91;domain\/yourdomain.com]\ndefault_shell = \/bin\/bash\nkrb5_store_password_if_offline = True\ncache_credentials = True\nkrb5_realm = YOURDOMAIN.COM\nrealmd_tags = manages-system joined-with-adcli\nid_provider = ad\nfallback_homedir = \/home\/%u@%d\nad_domain = yourdomain.com\nuse_fully_qualified_names = False\nldap_id_mapping = True\naccess_provider = ad\nad_gpo_access_control = permissive\n\n&#91;nss]\nfilter_groups = root\nfilter_users = root\nreconnection_retries = 3\n\n&#91;pam]\nreconnection_retries = 3<\/code><\/pre>\n\n\n\n<p>Set the correct permissions and reboot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod 600 \/etc\/sssd\/sssd.conf\nsudo reboot<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This guide was one of several that was pieced together during our recent network overhaul&#8230;<\/p>\n","protected":false},"author":55,"featured_media":121,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-98","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":3,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/posts\/98\/revisions\/103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/media\/121"}],"wp:attachment":[{"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.blackcatsystems.org\/index.php\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}