Linux login default user

Linux Mint Forums

What is the default user and password — before any has been defined?

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

What is the default user and password — before any has been defined?

Post by occam0 » Thu Sep 15, 2016 3:27 am

Installing Mint 18 KDE(64); proceeding nicely.. but suddenly the screen goes black and the text «The screen locker is broken and unlocking is not possible anymore. In order to unlock switch to a virtual terminal (e.g. Ctrl+Alt+F2), log in and execute the command. » appears.
Ctrtl+Alt+F2 works and a request to log in appears.
BUT I have not entered any user name or password yet: what should I do?

Re: What is the default user and password — before any has been defined?

Post by xenopeek » Thu Sep 15, 2016 4:15 am

Default username is mint. I think the password is blank (empty). Don’t know the screen locker would be active on the LiveISO but you can likely disable it in system settings.

Also, Ctrl+Alt+F7 or F8 is likely needed to go back to the graphical desktop.

Источник

Change default login user for Linux from root

I’ve been working with Linux for awhile and was wondering how I could go about changing the default login user. The whole time I’ve used Ubuntu, I’ve been logging in as the root node, as bad as that is. It does it automatically upon startup. Running Ubuntu in Windows Terminal with WSL. I’d appreciate any help. Thank you!

That did the trick. Had to create/source .profile into my home user directory, because I lost my colors, but all is well now. Thank you!

2 Answers 2

Went to the above link, and just went into cmd.exe and did: ubuntu2004 config —default-user

This caused a secondary issue where I lost my colors on the terminal, but that was resolved with:

  1. sudo nano /etc/passwd
  2. Scroll down to your user and change the numbers for user id and group both to 0. Example:
Читайте также:  Nvidia linux установка драйверов run

Be aware as this may result to unstable OS in some distros, or it may cause that some apps stop working.

No, no, no! This changes your user account to be effectively the same as root, which removes just about all protections the system can otherwise give you from shooting yourself in both feet

You must log in to answer this question.

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

How to change default user in WSL Ubuntu bash on Windows 10

I installed the WSL Bash on Windows 10 and set my user to e.g. ‘abc’ but now I want to change it to something else. How can I change the user name of the user I’m logged in as? When I open bash it automatically logs me in with my current user.

As of now, Ubuntu 20.04 is current. After its installed using WSL 2, the ubuntu2004 command becomes available for use: ubuntu2004 config —default-user robert

For those who didn’t installed via store (e.g via export/import): github.com/microsoft/WSL/issues/3974#issuecomment-576782860. Default user can be changed by creating a /etc/wsl.conf file

Thanks so much @SebastianHoffmann, this comment is what made me realise that it was all due to the import. Thought when I exported that everything would be an exact copy, but I guess not.

9 Answers 9

Now that LxRun.exe is deprecated, if you install Ubuntu from the Windows store the command you will need to run at a windows command prompt is

ubuntu config --default-user

(Note: depending on which version you installed this could be ubuntu1804.exe or ubuntu2004.exe )

If you’re using WSL2, you’re done.

For WSL1, you’ll need to also restart LxssManager service

sc stop LxssManager sc start LxssManager 

ubuntu might NOT be your default, it depends which version you installed so check the answers below, as mine is «ubuntu1804 config . «

instead of setting the default user it opened bash for me. It does not seem to be working for some reason. I am on the latest release of Windows as of today

With WSL 2 in use, it was not required to restart the LxSSManager service for the container to use the change

The top answer ( ubuntu config —default-user root ) is currently correct for the default instance. But if you have multiple instances, you need to work slightly harder:

Inside the instance, as root, create/edit /etc/wsl.conf and add these lines:

Then close it, run wsl —terminate in PowerShell, and restart it.

Читайте также:  Hex редактор linux debian

That’s from an issue in the WSL repo. The registry hack answer is also in there, but /etc/wsl.conf is now officially the supported solution.

All other answers were helpful, but can be other scenarios too, follow here as per yours. Mine was Ubuntu 16.04, so I used the following:

ubuntu1604 config --default-user

If you installed Ubuntu 18.04:

ubuntu1804 config --default-user

If you used the default one, then:

ubuntu config --default-user

Should this not change the current username to the username I provide in ? When I try this it just tells me the username I am providing does not exist. This is on 18.0.4

If you’re running Ubuntu 18.04 from the Microsoft Store, the command (powershell or cmd) will be:

ubuntu1804 config --default-user

You can change the default user for bash by running the following command in a normal command prompt (cmd.exe):

Old question that got bumped today, but the answers need updating and consolidating to be current (and correct).

There are two parts to the question, and every answer here so far just covers one or the other.

How can I change the user name of the user I’m logged in as?

As @PJ127 correctly pointed out, the first step is to actually change the username within Ubuntu. This can most easily be done (now, in 2021) by exiting WSL and starting PowerShell, then:

wsl -l -v wsl --terminate # from the previous command wsl -u root -d # "-d " is only needed for non-default instances # Now from in WSL usermod -l newname oldname # Optionally change the home directory name to match usermod -d /home/doug -m doug # Optionally change the group name to match groupmod -n newname oldname 

Then there’s the second part of the question, which is what most of the answers here attempt to cover:

When I open bash it automatically logs me in with my current user

There are multiple ways of doing this, but the Microsoft recommended/documented method in 2021 is as @Jacktose answered:

    In your WSL instance, sudo editor /etc/wsl.conf with the following contents:

While the ubuntu.exe —config method will work, there are two problems:

  • It’s not always «ubuntu.exe». The name of the executable (technically «app execution alias») depends on which version you installed from the Store. Ubuntu has come in multiple Store packages over the years. There’s a package for each supported release (e.g. ubuntu2004.exe , etc.) and one for the «current» version ( ubuntu.exe ). And while this is Ask Ubuntu, it also could be alpine.exe , etc. if you are using a different distribution.
  • It also, as has been pointed out in other answers, does not work if you have more than one instance installed (which is a great feature of WSL). It will only work for the first, store-installed instance.

Then, of course, there are registry-based methods of changing the default name, but since we have safer, supported methods let’s not even cover those here. 🙂

Источник

How to set default user for manually installed WSL distro?

I have cloned a WSL distro using wsl —export and wsl —import , but now, running wsl newdistro always logs me in as root. I understand that the lxrun command is deprecated and want to avoid it. The docs recommend using distroname.exe config , but that doesn’t work, since this one doesn’t have a corresponding executable.

Читайте также:  Driver 3060 for linux

7 Answers 7

As of the time of this writing, there are at least three (let’s call it 3.5) different methods of changing/setting the default user in an imported WSL instance. While the two that have already been mentioned still work, there is a Microsoft recommended way to do it that hasn’t been mentioned yet in this question.

Method 1 — /etc/wsl.conf

The current Microsoft recommended way of setting the username in an instance is to create a /etc/wsl.conf in the instance with the following setting:

Changing, of course, username to be your default username.

Exit your distro/instance, then issue a wsl —terminate from PowerShell or CMD. When you restart, the default user should be set.

This is safer and less error-prone than the registry-based methods.

Method 2 — Registry Key

Setting the registry key per @harrymc’s answer.

Method 3 — LxRunOffline

Using LxRunOffline to set the registry entry, as described in @Jaime’s answer. Ultimately this has the same effect as Method 2.

Semi-method 4 — Runtime user selection via wsl commandline argument

The username can be selected when starting any WSL instance by:

wsl -u username or wsl -d distroname -u username , etc.

For instance, wsl -d Ubuntu -u root .

Side Note: This question was specifically about setting the default username in an imported instance. However, for completeness, you can also set the default username for a distro that was installed from the Store (or wsl —install ) with:

For instance, if you installed «Ubuntu 20.04» from the Store, you would use:

ubuntu2004.exe config --default-user

The .exe here is an «App Execution Alias» in Windows. You can check the name by going to «Manage app execution aliases» in the Windows System Settings.

For readers who need to create a new user

@ndemou made a good point in the comments last year that I, in hindsight, dismissed improperly. Two other users have now mentioned in the comments that @ndemou’s information was helpful. My belated apologies! Here’s the additional information based on @ndemou’s advice .

Some users who find this answer may be starting up as root not because they —import ‘d a distribution, but possibly because the default user was never created during installation in the first place. This can happen when the distribution installation is stopped prematurely, and likely for other reasons as well.

Under Ubuntu, the default distribution for WSL, you can create your user by starting with:

If you need to, add the -d option.

NEWUSER= useradd --create-home --shell /usr/bin/bash --user-group --groups adm,dialout,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev --password $(read -sp Password: pw ; echo $pw | openssl passwd -1 -stdin) $NEWUSER 

Then set the user as the default using the /etc/wsl.conf as mentioned above.

If you’ve already created the user, or are using a different distribution, as @ndemou points out, make sure to also add the user either to a group that is in sudoers or directly to sudoers via visudo . See the answers to this question for additional details.

Источник

Оцените статью
Adblock
detector