LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-19-2024, 01:17 PM   #1
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441
Blog Entries: 43

Rep: Reputation: 36
Linux Mint 21.3 - Having Trouble Joining Domain with Samba


I'm using Linux Mint 21.3, and I hope 22 comes out soon. However, I hope it doesn't come out until I figure this out... OK. I renamed my domain controller following some instructions somewhere. I was going to create it from scratch but I found out, that possibly just renaming it was better. I called the domain smiley.fname. I tried to use .home.arpa, but as I found out, I can't do subdomains off of that, or at least the way I was trying. I need subdomains off of my domain to make the thing work.

So I chose .fname, standing for family name. Then I could still have bunches of subdomains off of it, like clients.smiley.fname.

Now, I "think" windows 10 will still join the domain again. However, I'm having trouble joining the domain with Linux Mint 21.3.

Why? Well first off, I'm using scripts, as doing it without is error prone and now with my scripts I can repeat it over and over, on many machines.

The first thing, I needed to do, is write some code, so that I could either join the domain freshly, or join it when I'm already joined to another domain, which is my previous domain, which no longer works.

That code all works fine. I found out, I still need some of my old zones I think, so that the domain controller which is renamed works. Doing this, by restoring my snapshot and not removing some of the information, helps and I think the server now works - I think. I'm using windows server 2019 for my server.

I got the domain to join with samba, on my tests, I think it will keep working too. But now, I need to be able to add a line to the host file I think, because it won't do it's dynamic updates properly.

So how, can I have the computer add a line to the host file, in it's correct format in order to have an entry for my samba server which I want to join to the AD domain? If I can do that, and it works, and no longer tells me

Code:
NT_STATUS_INVALID_PARAMETER
...then I think I'm just about finished with my script. I'm testing on a VM.
 
Old 05-19-2024, 09:42 PM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
So I know a command:

Code:
hostname -I | awk '{print$1}'
...Which will print the IP Address. Similarily:

Code:
hostname -A | awk '{print$1}'
...Will print the FQDN of the computer. If I could write those to a file, and also somehow get just the hostname part, which looks like I can use parameter "-s", for, even if I have newlines seperating the parameters instead of spaces, I can then replace the newlines with spaces in the file, and then write the output of the file to the end of the /etc/hosts file, and job done, I think. My problem, is that I'm also having permission issues when I try to write the file where I want it. A place that wouldn't mess with anything else. /etc/settings/hostdata, with hostdata being the file name.

I use /etc/settings constantly, as it's my standard for things like this. However, I would need root permission to write to the file. But looking at it again, I see that I probably have a permission issue anyway, and that dir is supposed to be 777, so it may not be an issue. Unless I'm relying on different standards and forgot it didn't need to be 777, I think that changing it to that, is the solution. But if this doesn't work, I'll be back here to say. If I can do that, my problem might be mute.
 
Old 05-19-2024, 10:50 PM   #3
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
So changing it to 777, I think, was part of the answer. Also, these commands were too:

Code:
sudo cp -f /etc/hosts /etc/hosts.old
sudo cp -f /usr/bin/hosts-linux_mint_21.3-patch /etc/hosts.new
sudo chmod 777 /etc/hosts.new
echo >> /etc/hosts.new
echo >> /etc/hosts.new
echo "# Added for DNS Update" >> /etc/hosts.new
hostname -I | awk '{print$1}' > /etc/settings/hostdata
hostname -A | awk '{print$1}' >> /etc/settings/hostdata
hostname -s >> /etc/settings/hostdata
tr '\n' ' ' < /etc/settings/hostdata > /etc/settings/hostdata2
cat /etc/settings/hostdata2 >> /etc/hosts.new
echo >> /etc/hosts.new
sudo cp -f /etc/hosts.new /etc/hosts
Those commands will set the host file up for me. Also, I needed to properly set the host name and domain name, according to my standard way of doing it. I'll repost my changes to my software later, back on github. It appears that I figured it out, with much thought and much time! I would have preferred to figure it out sooner, as it took basically my whole day. I'll retest on my VM, before I start applying it to my real machines. If I have more trouble, I'll mention it, but I think I can mark as solved unless I run into some kind of additional problem related to this.
 
Old 05-19-2024, 10:51 PM   #4
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
And yes, adding those things to the host file, worked and solve my origional issue.
 
Old 05-20-2024, 02:55 AM   #5
rpenny
Member
 
Registered: Jul 2019
Posts: 83

Rep: Reputation: Disabled
I don't understand your problem with 'home.arpa', from my testing you can use subdomains with it e.g. ad.home.arpa
You also shouldn't have renamed your AD domain, it isn't supported by Samba

Finally, if you are going to set your hosts info in /etc/hosts, wouldn't it be easing using something like this:

echo "$(hostname -I)$(hostname -f) $(hostname -s)" >> /etc/hosts

After backing up the old hosts file first and checking the line isn't already there.
 
Old 05-20-2024, 03:44 AM   #6
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
If it's finally working, I don't want to mess with it for now, but I might in the future. So I put a note in my code for that. Thanks for the shortand! I'm going to assume for now, that the line isn't already there, and if it is, leave it up to the user to delete it. Being that smart doesn't seem right, and seems like it could backfire for now.

I know you can do ad.home.arpa, but what about ad2.ad.home.arpa or clients.ad.home.arpa? That was where I had trouble. Doing so, is needed for sure in my particular network, that's why I finally did fname. But perhaps I didn't know enough about AD to implement it properly. I don't know what's not supported about it with samba, but if it's working, and probably won't quit working, then I'm going to be fine. I DID have to leave some old data to get it to work, but it's working.

I renamed it because it will take a long, long time to rebuild the whole domain from scratch, because if one gpo is out of place, it won't work. What I need in the future, is some scripts to set it up. When I switch over to samba for the AD server as well, things will help. Right now, I'm stuck using windows server. I'm not a BIG AD network, but I'm big enough that I need the server to make things easier. I can always try to rename it again, if I can get home.arpa to work.
 
Old 05-20-2024, 04:57 AM   #7
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,441

Original Poster
Blog Entries: 43

Rep: Reputation: 36
It should be noted, that I didn't do this:

https://wiki.samba.org/index.php/Domain_rename_tool

I did this:

https://theitbros.com/how-to-rename-...ectory-domain/

Then, I had to manually fix gpos, and then I manually fixed the DNS server, while leaving the primary zone alone, except removing every A/AA and CNAME record, except for the one pointing to the domain controller itself.

It sounds like technically, the other way would be easier, but much less effective for long term. Remember, the server for now, is Windows Server 2019, it's only most of the clients which are Linux Mint.
 
  


Reply



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
[SOLVED] samba: after joining the domain the server loose the domain controller r_ramp Linux - Server 1 05-09-2012 07:12 AM
"the trust relation between this workstation and the primary domain failed" windows 7 domain joining ach68 Linux - Server 2 03-27-2011 11:33 PM
Joining a linux machine to a windows domain having a wndows 2003 as domain contoller sukalyan_g SUSE / openSUSE 1 03-28-2008 01:31 AM
Joining a machine from another domain to my linux samba domain acummins Linux - Networking 0 09-13-2003 07:07 AM
Trouble with XP box joining samba domain Jason_25 Linux - Networking 2 05-09-2002 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:08 PM.

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