Closed suntong closed 4 years ago
Starting wsl.exe or wsltty.exe or wslbridge.exe would not gain root privilege in WSL distribution. Why on earth do you want to rename /home
directory?
You could modify the invocation (e.g. in the desktop shortcut) to invoke sudo
implicitly, but then you'll have to enter your password initially, unless your distribution would allow to configure sudo to work without password (?).
Replace --WSL=
distro with --wsl /bin/wslbridge2 -d
distro. (wslbridge2 following any mintty parameters)
Replace -~
with wslbridge2 parameter --wsldir ~
.
Append invocation of sudo with shell.
Example:
C:\Users\towo\AppData\Local\wsltty\bin\mintty.exe --wsl --configdir="C:\Users\towo\AppData\Roaming\wsltty" /bin/wslbridge2 --wsldir ~ /usr/bin/sudo bash -
You could modify the invocation (e.g. in the desktop shortcut) to invoke
sudo
implicitly, but then you'll have to enter your password initially, unless your distribution would allow to configure sudo to work without password (?).
Oh thanks for your reply @mintty, I guess I wasn't very clear in my OP that,
There are many things that I cannot do even with sudo
within wsltty.
What I meant by starting wsltty with elevated privilege is a very Windows-thing, For e.g.,
For opening the Command Prompt as Administrator, i.e., to open the Command Prompt with Administrative Privileges
This is what I can't do with wsltty
icon so far.
Sure you can. Windows offers a generic "Run as administrator" item in the context menu. But why would you want to run the terminal elevated? It doesn't give you anything.
Ah, indeed, there is "Run as administrator" item in the context menu, but not in the pined icon.
why would you want to run the terminal elevated? It doesn't give you anything.
It does:
I.e., I cannot do even with sudo within normal wsltty, but starting wsltty with elevated privilege is OK.
Not reproduced. Running an un-elevated terminal, then sudo in WSL, gives me all access rights, also in /mnt/c folders.
You machine must have disabled UAC. Here is how to check:
Here is my UAC setting:
How to start
wsltty
with elevated privilege?I cannot rename '/home' under wsl:
I thought about why I cannot rename '/home' under wsl and the workarounds, and I believe that the reason is, WSL is installed with elevated privilege, while my wsl bash is started with normal privilege. There are just many things that cannot be done because of that, not just moving /home, any files/folders that need elevated privilege to access cannot be altered within wsl bash.
Hence, how to start
wsltty
with elevated privilege?