Linux: How to add linux ubuntu to a Windows Domain
To start this post i'm assuming you already have a Windows server installed with Active Directory Domain Services configured and the Windows DNS server also setup at you Linux Machine (remeber edit the /etc/resolv.conf for that) I'm also assuming you have all samba services installed on your linux machine. Well lets start then, I'm using Ubunt as an example so i'll be using apt-get to install the packages i'll need. And those packages are: likewise-open-gui - GUI for Likewise Open Authentication service. Likewise Open likewise-open - Authentication services for Active Directory Domains
I'm Using Ubunt 8.04 LTS as my main distribution i recommend you use the apt-get search likewise to see if it matches for you distribution.
First we need to edit the file lwiauthd.conf located in /etc/samba directory, check if contains configurations on it, if it does, make a backup using the mv command just like this:
mv /etc/samba/lwiauthd.conf /etc/samba/lwiauthd.conf.backup
Ok, now we're ready to move on, make a new lwiauthd.conf, i'm going to use the vim editor but you can use any editor of your preference. At the shell type (remember you can use sudo) #vim /etc/samba/lwiauthd.conf inside that new file type at the top the following:
winbind use default domain = yes
Exit the editor making sure to save your configurations made.
Now to actually join the domain, in the cli type:
# domainjoin-cli join yourdomain.com username (it's important to use a user that is already setup in Active directory, create one, preferable inside the domain admins group and administrators) it will ask for the domain user's password, type it and it should give you the shell back.
At this point if you go to your Active Directory Users and Computers in the Computers Container you will be able to see you Linux Machine listed there.
Reboot the Linux machine and in the logon screen use the following sintax to logging into the domain:
[email protected] and next type the domain user's password.
But we've a little problem here, if logging with your domain user, you'll not be able to execute any commands using sudo, that's because that user is not in the sudoers file, go to Active Directory Users and Computers in the users container, locate the user and check the groups he's member of, in the member of tab, with that in hand let's add it to the sudoers file:
Remeber to log into the Linux Machine LOCALLY (not in the domain) # vim /etc/sudoers
Scroll all the way down the file were you can see the # Members of the admin group may gain root privileges You will notice that you already have an entry there, it's the default, let's add our domain user to this section, following this exact syntax:
%yourdomain\\user^usergroup ALL=(ALL) ALL <--(You need to use the double inverted slash, tumblr is not showing correctly but you need to use the double inverted slash after the yourdomain "\\\")
now save the file, logoff, log with you domain user and try to run anything uing sudo, for example: $ sudo vim /etc/passwd
And that it is!
Any doubts feel free to contact me CYA!










