Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run Windows bash without being root?

Is there a way to create a user in the new Windows 10 implementation of bash so that I'm not running it as root, without having to create a different user account in the Windows 10 system? I want to use Windows as an administrator with my normal user account but when I launch bash I want it to launch into an account other than the default account, which I'm guessing is automatically root (in the Linux subsystem) since it's the administrator account (in the Windows system).

like image 642
Marc Adler Avatar asked Sep 02 '16 23:09

Marc Adler


People also ask

How do I run a Bash command in Windows?

To access the shell, simply type 'bash' in the Windows command prompt, and everything is good to go.

How do I run a command without root in Linux?

sudo (superuser do) allows you to configure non-root users to run root level commands without being root. Access can be given by the root level administrator through configuration of the /etc/sudoers file.

How do I run Bash as root in Windows?

Get Bash In Windows 10 After you turn it on, open the Control Panel app and go to Programs>Turn Windows Features On or Off. Select Windows Subsystem for Linux. Open Command Prompt (with admin rights) and type Bash. Windows 10 will download and install Bash.

Can you install Bash on Windows?

What to Know. Developer Mode: Right-click Start menu > select Settings > Update & Security > For developers. Next: Select Developer mode > Yes > enable Windows Subsystem For Linux > restart. Use bash: Right-click Start menu > select Windows PowerShell (Admin) > type "bash" > press Enter.


1 Answers

WSL is specially designed not to compromise the normal Windows security, and it is (currently) "client-only". Thus, the "root" inside a WSL session is just simulation to make things look more real for stuff you run in the "Linux" environment. From the Windows point of view, root in WSL is the same user which launched the WSL. If this user is an elevated admin, the WSL programs are too.

For details, see the few available Channel9 videos and WSL blog.

To the original question - how to "drop" admin privileges for running WSL, see for example here.

like image 184
ddbug Avatar answered Sep 18 '22 23:09

ddbug