Skip to content

Commit 29bfbb0

Browse files
committed
Update user account page content, create user account archive page
1 parent 605383a commit 29bfbb0

3 files changed

Lines changed: 128 additions & 111 deletions

File tree

WSL/file-permissions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
title: File Permissions
33
description: Understanding how WSL determines file permissions in Windows
44
keywords: BashOnWindows, bash, wsl, wsl2, windows, windows subsystem for linux, windowssubsystem, ubuntu, debian, suse, windows 10, file,permissions
5-
ms.date: 10/7/2019
5+
ms.date: 01/14/2020
66
ms.topic: article
77
ms.assetid: 7afaeacf-435a-4e58-bff0-a9f0d75b8a51
88
ms.custom: seodec18
99
---
1010

11+
# File Permissions for WSL
12+
1113
This page details how Linux file permissions are interpreted across the Windows Subsystem for Linux, especially when accessing resources inside of Windows on the NT file system. This documentation assumes a basic understanding of the [Linux file system permissions structure](https://wiki.archlinux.org/index.php/File_permissions_and_attributes) <!--TODO: Double check that it's okay to add these links--> and the [umask command](https://en.wikipedia.org/wiki/Umask).
1214

1315
When accessing Windows files from WSL the file permissions are either calculated from Windows permissions, or are read from metadata that has been added to the file by WSL. This metadata is not enabled by default.

WSL/user-support-archived.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: WSL User Account updates on Previous Windows Versions
3+
description: Reference for Previous Windows Versions to update Linux user accounts with the Windows Subsystem for Linux.
4+
ms.date: 01/20/2020
5+
ms.topic: article
6+
ROBOTS: NOINDEX
7+
---
8+
9+
# WSL User Account updates on Previous Windows Versions
10+
11+
This content is archived for users of earlier versions of Windows operating system that support the subsystem for Linux and need support with updating Linux user accounts.
12+
13+
For current documentation, see [User Accounts for Windows Subsystem for Linux](../user-support.md).
14+
15+
### For Creators Update version of Windows and earlier
16+
17+
If you're running Windows 10 Creators update or earlier, you can change the default Bash user by running the following commands:
18+
19+
1. Change the default user to `root`:
20+
21+
```console
22+
C:\> lxrun /setdefaultuser root
23+
```
24+
25+
1. Run `bash.exe` to now login as `root`:
26+
27+
```console
28+
C:\> bash.exe
29+
```
30+
31+
1. Reset your password using the distribution's password command, and close the Linux Console:
32+
33+
```BASH
34+
$ passwd username
35+
$ exit
36+
```
37+
38+
1. From Windows CMD, reset your default user back to your normal Linux user account:
39+
40+
```console
41+
C:\> lxrun.exe /setdefaultuser username
42+
```
43+
44+
### For Fall Creators Update and later
45+
46+
To see what commands are available for a particular distribution, run `[distro.exe] /?`.
47+
48+
For example, with Ubuntu installed:
49+
50+
```console
51+
C:\> ubuntu.exe /?
52+
53+
Launches or configures a linux distribution.
54+
55+
Usage:
56+
<no args>
57+
- Launches the distro's default behavior. By default, this launches your default shell.
58+
59+
run <command line>
60+
- Run the given command line in that distro, using the default configuration.
61+
- Everything after `run ` is passed to the linux LaunchProcess cal
62+
63+
config [setting [value]]
64+
- Configure certain settings for this distro.
65+
- Settings are any of the following (by default)
66+
- `--default-user <username>`: Set the default user for this distro to <username>
67+
68+
clean
69+
- Uninstalls the distro. The appx remains on your machine. This can be
70+
useful for "factory resetting" your instance. This removes the linux
71+
filesystem from the disk, but not the app from your PC, so you don't
72+
need to redownload the entire tar.gz again.
73+
74+
help
75+
- Print this usage message.
76+
```
77+
78+
Step by step instructions using Ubuntu:
79+
80+
1. Open CMD
81+
1. Set the default Linux user to `root`:
82+
83+
```console
84+
C:\> ubuntu config --default-user root
85+
```
86+
87+
1. Launch your Linux distribution (`ubuntu`). You will automatically login as `root`:
88+
89+
1. Reset your password using the `passwd` command:
90+
91+
```BASH
92+
$ passwd username
93+
```
94+
95+
1. From Windows CMD, reset your default user back to your normal Linux user account.
96+
97+
```console
98+
C:\> ubuntu config --default-user username
99+
```

WSL/user-support.md

Lines changed: 26 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,53 @@
11
---
2-
title: Linux User Account and Permissions
2+
title: Create and update user accounts for WSL distributions
33
description: Reference for user accounts and permission management with the Windows Subsystem for Linux.
44
keywords: BashOnWindows, bash, wsl, windows, windows subsystem for linux, windowssubsystem, ubuntu, user accounts
5-
ms.date: 09/11/2017
5+
ms.date: 01/20/2020
66
ms.topic: article
77
ms.assetid: f70e685f-24c6-4908-9546-bf4f0291d8fd
88
ms.custom: seodec18
99
ms.localizationpriority: high
1010
---
1111

12-
# User Accounts and Permissions for Windows Subsystem for Linux
12+
# Create and update user accounts for WSL distributions
1313

14-
Creating your Linux user is the first step in setting up a new Linux distribution on WSL. The first user account you create is automatically configured with a few special attributes:
14+
Once you have enabled WSL and installed a Linux distribution from the Microsoft Store, the first step you will be asked to complete when opening your newly installed Linux distribution is to create an account, including a **User Name** and **Password**.
1515

16-
1. It is your default user -- it signs-in automatically on launch.
17-
1. It is Linux administrator (a member of the sudo group) by default.
16+
- This **User Name** and **Password** is specific to your Linux distribution and has no bearing on your Windows user name.
1817

19-
Each Linux distribution running on the Windows Subsystem for Linux has its own Linux user accounts and passwords. You will have to configure a Linux user account any time you add a distribution, reinstall, or reset. Linux user accounts are not only independent per distribution, they are also independent from your Windows user account.
18+
- Once you create this **User Name** and **Password**, the account will be your default user for the distribution and automatically sign-in on launch.
2019

21-
## Resetting your Linux password
20+
- This account will be considered the Linux administrator, with the ability to run `sudu` (Super User Do) administrative commands.
2221

23-
If you have access to your Linux user account and know your current password, change it using Linux password reset tools of that distribution -- most likely `passwd`.
22+
- Each Linux distribution running on the Windows Subsystem for Linux has its own Linux user accounts and passwords. You will have to configure a Linux user account every time you add a distribution, reinstall, or reset.
2423

25-
If that's not an option, depending on the distribution, you may be able to reset your password by resetting the default user.
24+
## Reset your Linux password
2625

27-
WSL offers a default user tag to identify which user account automatically logs in when you start a WSL. Since many distributions include commands to set the default user to root and also a root user with no password set, changing the default user to root is a handy tool for things like password reset.
26+
To change your password, open your Linux distribution (Ubuntu for example) and enter the command: `passwd`
2827

29-
### For Creators Update and earlier
30-
If you're running Windows 10 Creators update or earlier, you can change the default Bash user by running the following commands:
28+
You will be asked to enter your current password, then asked to enter your new password, and then to confirm your new password.
3129

32-
1. Change the default user to `root`:
30+
### Forgot your password
3331

34-
```console
35-
C:\> lxrun /setdefaultuser root
36-
```
32+
If you forgot the password for your Linux distribution, try this:
3733

38-
1. Run `bash.exe` to now login as `root`:
34+
For Ubuntu:
35+
1. Open PowerShell and use it to change the default user name of your Ubuntu distribution to root with: `ubuntu config --default-user root`
3936

40-
```console
41-
C:\> bash.exe
42-
```
37+
2. Open your distribution (Ubuntu) and you should see that the prompt now lists `root@computername` rather than the user name you entered. Enter the command: `passwd <username>` (replacing the username you created for your account and forgot the password for).
4338

44-
1. Reset your password using the distribution's password command, and close the Linux Console:
39+
3. You will be prompted to enter a new UNIX password and then confirm that password. Once you're told that the password has updated successfully, close the Linux distribution (Ubuntu).
4540

46-
```BASH
47-
$ passwd username
48-
$ exit
49-
```
41+
4. Open PowerShell and use it to change the default user name of your Ubuntu distribution back to your username with: `ubuntu config --default-user <your username>`
5042

51-
1. From Windows CMD, reset your default user back to your normal Linux user account:
43+
5. Now re-open your Ubuntu distribution and you should see your username displayed as the prompt, rather than `root`. Now you can confirm that your password was correctly updated.
5244

53-
```console
54-
C:\> lxrun.exe /setdefaultuser username
55-
```
45+
For other Linux distributions, follow the same instructions, but in Powershell, change the command to align with the correct distribution name:
5646

57-
### For Fall Creators Update and later
58-
To see what commands are available for a particular distribution, run `[distro.exe] /?`.
59-
60-
For example, with Ubuntu installed:
47+
- openSUSE Leap 42: `openSUSE-42 config --default-user root`
48+
- SUSE Linux: `SLES-12 config --default-user root`
49+
- Debian: `debian config --default-user root`
50+
- Kali Linux: `kali config --default-user root`
6151

62-
```console
63-
C:\> ubuntu.exe /?
64-
65-
Launches or configures a linux distribution.
66-
67-
Usage:
68-
<no args>
69-
- Launches the distro's default behavior. By default, this launches your default shell.
70-
71-
run <command line>
72-
- Run the given command line in that distro, using the default configuration.
73-
- Everything after `run ` is passed to the linux LaunchProcess cal
74-
75-
config [setting [value]]
76-
- Configure certain settings for this distro.
77-
- Settings are any of the following (by default)
78-
- `--default-user <username>`: Set the default user for this distro to <username>
79-
80-
clean
81-
- Uninstalls the distro. The appx remains on your machine. This can be
82-
useful for "factory resetting" your instance. This removes the linux
83-
filesystem from the disk, but not the app from your PC, so you don't
84-
need to redownload the entire tar.gz again.
85-
86-
help
87-
- Print this usage message.
88-
```
89-
90-
Step by step instructions using Ubuntu:
91-
92-
1. Open CMD
93-
1. Set the default Linux user to `root`:
94-
95-
```console
96-
C:\> ubuntu config --default-user root
97-
```
98-
99-
1. Launch your Linux distribution (`ubuntu`). You will automatically login as `root`:
100-
101-
1. Reset your password using the `passwd` command:
102-
103-
```BASH
104-
$ passwd username
105-
```
106-
107-
1. From Windows CMD, reset your default user back to your normal Linux user account.
108-
109-
```console
110-
C:\> ubuntu config --default-user username
111-
```
112-
113-
## Permissions
114-
115-
There are two important concepts to keep in mind when it comes to permissions in WSL:
116-
117-
1. The Windows permission model governs a process' rights to Windows resources
118-
2. The Linux permission model controls a process' rights to Linux resources
119-
120-
When running Linux on WSL, Linux will have the same Windows permissions as the process that launches it. Linux can be launched in one of two permission levels:
121-
122-
* Normal (non-elevated): Linux runs with the permissions of the logged-in user
123-
* Elevated/admin: Linux runs with elevated/admin Windows permissions
124-
125-
> Because elevated processes can access/modify (and therefore damage) system-wide settings and system-wide/protected data, **AVOID** launching elevated processes unless you absolutely have to - whether they're Windows or Linux applications/tools/shells!
126-
127-
The above Windows permissions are independent of the permissions within a Linux instance: Linux "Root privileges" only impact the user’s rights within the Linux environment & filesystem; they have no impact on the Windows privileges granted. Thus, running a Linux process as root (e.g. via `sudo`) only grants that process admin rights within the Linux environment.
128-
129-
**Example:**
130-
A Bash session with Windows admin privileges may access `cd /mnt/c/Users/Administrator` while a Bash session without admin privileges would see a "Permission Denied" error.
131-
132-
In Linux, typing `sudo cd /mnt/c/Users/Administrator` will not grant access to the Administrator’s directory since permissions within Windows are managed by Windows.
133-
134-
The Linux permission model is important when inside the Linux environment where the user has permissions based on the current Linux user.
135-
136-
**Example:**
137-
A user in the sudo group may run `sudo apt update`.
52+
> [!NOTE]
53+
> If you are running an early version of Windows operating system, like 1703 (Creators Update) or 1709 (Fall Creators Update), see the [archived version of this user account update doc](../user-support-archived.md).

0 commit comments

Comments
 (0)