Comments (6)
Hi,
I played around with the scripts a bit, and I noticed that the sample script does a couple of bad things.
First, instead of adding the primary user directly to the sudoers with no password, the user should be added to the group sudo with the shell command
The script has a few design choices that I was forced into due to WSL's limitations. Since the distribution you are installing might not work out of the box, I try not to launch the new rootfs and do things there, instead try to manipulate files from the outside.
That's why I manually open the /etc/{passwd,shadow,group,gshadow}
files and migrate your current root password and your regular user account. While manipulating the group
file, I could add an entry of your regular user belonging to the sudo
group.
However, I'm not going to do that, since the sudo
group is distribution-specific. Debian and Ubuntu uses that, but Fedora/RHEL/Arch uses wheel
. The usermod
command may also not be installed on all distributions out of the box.
The bottom line is, the installer tries to do as much possible, without taking any distribution-specific steps.
Second, it should install sudo if the package manager is supported.
The provided hook already does this, but it's not enabled by default. Rename hook_postinstall_all.sample.sh
to hook_postinstall_all.sh
, and the installer will run it during every installation.
This is also the part which adds the user to sudoers
with NOPASSWD
, so I'm assuming you overlooked this.
I presume the best option would be to have an argument or environment variable control whether the regular user should be added to sudoers with NOPASSWD or not.
Third, for some reason with the ubuntu:devel docker image, you need to decompress with gzip the UTF8 charmap:
Haven't really used ubuntu:devel. I'll look into this, and update the sample hook script to do this, if necessary.
from wsl-distribution-switcher.
@RoliSoft I guess if you're adding the user directly to sudoers, don't give them NOPASSWD. Worst case scenario if locked out, they can do
lxrun /setdefaultuser root
from wsl-distribution-switcher.
9803686 fixes the locale issue. For me, SUPPORTED
was only a text file, not a directory, therefore the correct path to ungzip was /usr/share/i18n/charmaps/UTF-8.gz
.
I'll see what to do about the sudoers thing.
from wsl-distribution-switcher.
Yeah, it was only a text file. I reconstructed that path from my bash history, and I had accidentally tried to cd SUPPORTED by accident probably
from wsl-distribution-switcher.
22b0903 adds user to sudo
or wheel
depending on the distribution being APT or RPM-based.
The sudo command on ubuntu:devel seems to be broken, which imho just introduces more issues for the average user than NOPASSWD:
sudo: no tty present and no askpass program specified
You can run it with sudo -S
, and you can add an alias to your .bash_profile
, but I'm not going to modify the user's dotfiles automatically.
from wsl-distribution-switcher.
@RoliSoft It works fine here on 14905. I'm pretty sure that support for Xenial's and Yakkety's sudo command was added in 14902.
from wsl-distribution-switcher.
Related Issues (20)
- [!] Failed to fetch manifest info for cetos: HTTP Error 401: Unauthorized HOT 1
- "[!] The Linux subsystem is not installed. Please go through the standard installation procedure first." HOT 3
- Unable to find lxrun.exe in the expected locations. HOT 4
- [!] Failed to find tag 12.04 for image ubuntu.
- my_lookupdev: socket: Socket type not supported HOT 2
- WSL2 docker on centos7.6 not good
- gentoo install failed
- no such file or directory HOT 1
- `python install.py rootfs_kalilinux_kali-linux-docker_latest.tar.gz` with python 3.7 HOT 3
- bash - command not found HOT 1
- APT Key Expired and Unable to Update / Install HOT 4
- How can i install 3 different distros ?
- Instead of Centos 6 dowloading Centos 7 HOT 1
- Set default os in WSL
- With the Fall Creators update, is this dead? HOT 1
- Persistent "You do not seem to have the default distribution installed anymore."
- no lxss HOT 3
- python3 install.py rootfs_kalilinux_kali-linux-docker_ latest.tar.gz errors in files:
- get.prebuild.py fails on SSLError error [SSL: CERTIFICATE_VERIFY_FAILED]
- Unable to find lxrun.exe in the expected locations. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsl-distribution-switcher.