Windows 10: How do I run a root/admin script at WSL2 shell startup?

Discus and support How do I run a root/admin script at WSL2 shell startup? in Windows 10 Gaming to solve the problem; So, on Linux I would put a script in /etc/profile.d, make it owned by root root:root and make it executable. I did all that in my WSL2 Windows 11 shell... Discussion in 'Windows 10 Gaming' started by Jeffrey L Cooke, Nov 3, 2022.

  1. How do I run a root/admin script at WSL2 shell startup?


    So, on Linux I would put a script in /etc/profile.d, make it owned by root root:root and make it executable. I did all that in my WSL2 Windows 11 shell and I get this:hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --verbose option to see the details of our search for an access method.So, how do I run something as root on WSL2 startup?Have made WSL2 Settings to:- Run the Ubuntu profile as Default- Run the Default profile as Administrator- Run the Ubuntu profile as AdministratorStill broken. The command in the shell script is simply: "/usr/sbin/hwclock -s"--Th

    :)
     
    Jeffrey L Cooke, Nov 3, 2022
    #1

  2. How do I disable root login in WSL2? "wsl -d ubuntu -u root" from Terminal will login to root shell without requiring passwd.

    Is the following behavior correct and expected?

    With WSL2 (Ubuntu 18.4, Windows 10 2004 19041.207), from a non-admin Windows Terminal, I can execute "wsl -d ubuntu -u root" and login to a root shell, without requiring a password (even if a root password is set).

    I just installed the distro. It created a sudo user as described in the manual. If I login with "Ubuntu.exe" it will default to the sudo user and require the configured password.

    From the root shell I "passwd". Exit. Try again "wsl -d ubuntu -u root", and it bypasses any password protection again. Even though it should be set.

    I've been googling this without any definite answers.
     
    diegoag666, Nov 3, 2022
    #2
  3. sachind1 Win User
    script running on Startup and Shutdown of System is not working

    Steps

    • Open a run box
    • type in "gpedit.msc"
    • Expand Computer Configuration
    • Expand Windows Settings
    • Select Scripts (Startup/Shutdown)
    • Double click Startup
    • Click Show Files and copy/paste your file in to this folder
    • Click the Add button on the startup properties
    • Click Browse and double click on your script to choose it.
    • "OK" out of all windows to apply the new settings.
    I am generally Giving Path of My python to the startup and shutdown as steps given above
     
    sachind1, Nov 3, 2022
    #3
  4. Flaviu2 Win User

    How do I run a root/admin script at WSL2 shell startup?

    WSL2 for windows

    I have failed into installing WSL for Windows. I have read here: https://docs.microsoft.com/en-us/win.../install-win10 how to do it, and at step 4:


    1. Download the latest package:
      [COLOR=var(--text)][COLOR=var(--info-dark)] Note[/COLOR]
      If you're using an ARM64 machine, please download the ARM64 package instead. If you're not sure what kind of machine you have, open Command Prompt or PowerShell and enter: systeminfo | find "System Type".
      [/COLOR]
    2. Run the update package downloaded in the previous step. (Double-click to run - you will be prompted for elevated permissions, select ‘yes’ to approve this installation.)

    I encountered:


    How do I run a root/admin script at WSL2 shell startup? [​IMG]


    and


    How do I run a root/admin script at WSL2 shell startup? [​IMG]


    What I did wrong ? I have the following W10 version:

    How do I run a root/admin script at WSL2 shell startup? [​IMG]


    Another question: am I in the the right forum ?
     
    Flaviu2, Nov 3, 2022
    #4
Thema:

How do I run a root/admin script at WSL2 shell startup?

Loading...
  1. How do I run a root/admin script at WSL2 shell startup? - Similar Threads - run root admin

  2. Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...

    in Windows 10 Network and Sharing
    Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...: Windows 10Hello Is it possible to write a script for either a .bat file, or a CMD shell or Power Shell script, to automate running a single small .exe Snap2HTML.exe over and over again while stating the program parameters. I wish to use a small program called Snap2html...
  3. Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...

    in Windows 10 Gaming
    Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...: Windows 10Hello Is it possible to write a script for either a .bat file, or a CMD shell or Power Shell script, to automate running a single small .exe Snap2HTML.exe over and over again while stating the program parameters. I wish to use a small program called Snap2html...
  4. Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...

    in Windows 10 Software and Apps
    Script for either a .bat file, or a CMD shell or Power Shell script, to automate running a...: Windows 10Hello Is it possible to write a script for either a .bat file, or a CMD shell or Power Shell script, to automate running a single small .exe Snap2HTML.exe over and over again while stating the program parameters. I wish to use a small program called Snap2html...
  5. How do I run this python script?

    in Windows 10 Gaming
    How do I run this python script?: https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any additional things or verify anything?Thanks if you can guide me....
  6. How do I run this python script?

    in Windows 10 Customization
    How do I run this python script?: https://pypi.org/project/autoeq/How do I run it? Also, what can I do to make sure that my laptop can run the script? Do i need to install any additional things or verify anything?Thanks if you can guide me....
  7. Unknown Power shell script running

    in Windows 10 Gaming
    Unknown Power shell script running: Hi,I usually get a brief pop-up for a script that runs at random times as far as I can gather. Its only for a split second, but its a nuisance if I am gaming as my controller is just disabled until I swap out and back to the game window again.I can see that there are several...
  8. Unknown Power shell script running

    in Windows 10 Software and Apps
    Unknown Power shell script running: Hi,I usually get a brief pop-up for a script that runs at random times as far as I can gather. Its only for a split second, but its a nuisance if I am gaming as my controller is just disabled until I swap out and back to the game window again.I can see that there are several...
  9. How do I run a root/admin script at WSL2 shell startup?

    in Windows 10 Software and Apps
    How do I run a root/admin script at WSL2 shell startup?: So, on Linux I would put a script in /etc/profile.d, make it owned by root root:root and make it executable. I did all that in my WSL2 Windows 11 shell and I get this:hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --verbose option to see the...
  10. How to run .sh or Shell Script file in Windows 10

    in Windows 10 News
    How to run .sh or Shell Script file in Windows 10: [ATTACH] [ATTACH]Shell Scripts or .SH files are like batch files of Windows which can be executed in Linux or Unix. It is possible to run .sh or Shell Script file in Windows 10 using Windows Subsystem for Linux. In this post, [...] This post How to run .sh or Shell Script...