Skip to content

Commit 8593f2d

Browse files
[Doc-A-THon] Updating code block
- Updating code block from console to bash - Adding sudo on a few commands.
1 parent 3efbe73 commit 8593f2d

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

articles/active-directory-domain-services/join-ubuntu-linux-vm.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Once the VM is deployed, follow the steps to connect to the VM using SSH.
5555

5656
To make sure that the VM host name is correctly configured for the managed domain, edit the */etc/hosts* file and set the hostname:
5757

58-
```console
58+
```bash
5959
sudo vi /etc/hosts
6060
```
6161

@@ -66,7 +66,7 @@ In the *hosts* file, update the *localhost* address. In the following example:
6666

6767
Update these names with your own values:
6868

69-
```console
69+
```config
7070
127.0.0.1 ubuntu.aaddscontoso.com ubuntu
7171
```
7272

@@ -78,7 +78,7 @@ The VM needs some additional packages to join the VM to the managed domain. To i
7878

7979
During the Kerberos installation, the *krb5-user* package prompts for the realm name in ALL UPPERCASE. For example, if the name of your managed domain is *aaddscontoso.com*, enter *AADDSCONTOSO.COM* as the realm. The installation writes the `[realm]` and `[domain_realm]` sections in */etc/krb5.conf* configuration file. Make sure that you specify the realm an ALL UPPERCASE:
8080

81-
```console
81+
```bash
8282
sudo apt-get update
8383
sudo apt-get install krb5-user samba sssd sssd-tools libnss-sss libpam-sss ntp ntpdate realmd adcli
8484
```
@@ -89,13 +89,13 @@ For domain communication to work correctly, the date and time of your Ubuntu VM
8989

9090
1. Open the *ntp.conf* file with an editor:
9191

92-
```console
92+
```bash
9393
sudo vi /etc/ntp.conf
9494
```
9595

9696
1. In the *ntp.conf* file, create a line to add your managed domain's DNS name. In the following example, an entry for *aaddscontoso.com* is added. Use your own DNS name:
9797
98-
```console
98+
```config
9999
server aaddscontoso.com
100100
```
101101
@@ -109,7 +109,7 @@ For domain communication to work correctly, the date and time of your Ubuntu VM
109109
110110
Run the following commands to complete these steps. Use your own DNS name with the `ntpdate` command:
111111
112-
```console
112+
```bash
113113
sudo systemctl stop ntp
114114
sudo ntpdate aaddscontoso.com
115115
sudo systemctl start ntp
@@ -121,7 +121,7 @@ Now that the required packages are installed on the VM and NTP is configured, jo
121121
122122
1. Use the `realm discover` command to discover the managed domain. The following example discovers the realm *AADDSCONTOSO.COM*. Specify your own managed domain name in ALL UPPERCASE:
123123
124-
```console
124+
```bash
125125
sudo realm discover AADDSCONTOSO.COM
126126
```
127127
@@ -135,13 +135,13 @@ Now that the required packages are installed on the VM and NTP is configured, jo
135135
136136
Again, the managed domain name must be entered in ALL UPPERCASE. In the following example, the account named `[email protected]` is used to initialize Kerberos. Enter your own user account that's a part of the managed domain:
137137

138-
```console
139-
138+
```bash
139+
sudo kinit -V [email protected]
140140
```
141141

142142
1. Finally, join the VM to the managed domain using the `realm join` command. Use the same user account that's a part of the managed domain that you specified in the previous `kinit` command, such as `[email protected]`:
143143
144-
```console
144+
```bash
145145
sudo realm join --verbose AADDSCONTOSO.COM -U '[email protected]' --install=/
146146
```
147147
@@ -155,7 +155,7 @@ If your VM can't successfully complete the domain-join process, make sure that t
155155
156156
If you received the error *Unspecified GSS failure. Minor code may provide more information (Server not found in Kerberos database)*, open the file */etc/krb5.conf* and add the following code in `[libdefaults]` section and try again:
157157
158-
```console
158+
```bash
159159
rdns=false
160160
```
161161
@@ -165,21 +165,21 @@ One of the packages installed in a previous step was for System Security Service
165165
166166
1. Open the *sssd.conf* file with an editor:
167167
168-
```console
168+
```bash
169169
sudo vi /etc/sssd/sssd.conf
170170
```
171171
172172
1. Comment out the line for *use_fully_qualified_names* as follows:
173173
174-
```console
174+
```config
175175
# use_fully_qualified_names = True
176176
```
177177
178178
When done, save and exit the *sssd.conf* file using the `:wq` command of the editor.
179179
180180
1. To apply the change, restart the SSSD service:
181181
182-
```console
182+
```bash
183183
sudo systemctl restart sssd
184184
```
185185
@@ -193,37 +193,37 @@ By default, users can only sign in to a VM using SSH public key-based authentica
193193
194194
1. Open the *sshd_conf* file with an editor:
195195
196-
```console
196+
```bash
197197
sudo vi /etc/ssh/sshd_config
198198
```
199199
200200
1. Update the line for *PasswordAuthentication* to *yes*:
201201
202-
```console
202+
```config
203203
PasswordAuthentication yes
204204
```
205205
206206
When done, save and exit the *sshd_conf* file using the `:wq` command of the editor.
207207
208208
1. To apply the changes and let users sign in using a password, restart the SSH service:
209209
210-
```console
210+
```bash
211211
sudo systemctl restart ssh
212212
```
213213
214214
### Configure automatic home directory creation
215215
216216
To enable automatic creation of the home directory when a user first signs in, complete the following steps:
217217
218-
1. Open the */etc/pam.d/common-session* file in an editor:
218+
1. Open the `/etc/pam.d/common-session` file in an editor:
219219
220-
```console
220+
```bash
221221
sudo vi /etc/pam.d/common-session
222222
```
223223
224224
1. Add the following line in this file below the line `session optional pam_sss.so`:
225225
226-
```console
226+
```config
227227
session required pam_mkhomedir.so skel=/etc/skel/ umask=0077
228228
```
229229
@@ -235,13 +235,13 @@ To grant members of the *AAD DC Administrators* group administrative privileges
235235
236236
1. Open the *sudoers* file for editing:
237237
238-
```console
238+
```bash
239239
sudo visudo
240240
```
241241
242242
1. Add the following entry to the end of */etc/sudoers* file:
243243
244-
```console
244+
```config
245245
# Add 'AAD DC Administrators' group members as admins.
246246
%AAD\ DC\ Administrators ALL=(ALL) NOPASSWD:ALL
247247
```
@@ -254,29 +254,29 @@ To verify that the VM has been successfully joined to the managed domain, start
254254
255255
1. Create a new SSH connection from your console. Use a domain account that belongs to the managed domain using the `ssh -l` command, such as `[email protected]` and then enter the address of your VM, such as *ubuntu.aaddscontoso.com*. If you use the Azure Cloud Shell, use the public IP address of the VM rather than the internal DNS name.
256256
257-
```console
258-
ssh -l [email protected] ubuntu.aaddscontoso.com
257+
```bash
258+
sudo ssh -l [email protected] ubuntu.aaddscontoso.com
259259
```
260260
261261
1. When you've successfully connected to the VM, verify that the home directory was initialized correctly:
262262

263-
```console
264-
pwd
263+
```bash
264+
sudo pwd
265265
```
266266

267267
You should be in the */home* directory with your own directory that matches the user account.
268268

269269
1. Now check that the group memberships are being resolved correctly:
270270

271-
```console
272-
id
271+
```bash
272+
sudo id
273273
```
274274

275275
You should see your group memberships from the managed domain.
276276

277277
1. If you signed in to the VM as a member of the *AAD DC Administrators* group, check that you can correctly use the `sudo` command:
278278

279-
```console
279+
```bash
280280
sudo apt-get update
281281
```
282282

0 commit comments

Comments
 (0)