加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

win10bash中更改默认的用户

发布时间:2020-12-15 16:45:06 所属栏目:安全 来源:网络整理
导读:Win10已经支持Ubuntu的Bash了。 在cmd中输入bash就可以进入bash界面。但此时是普通用户登录的。 如果希望更改默认的登录用户,可以在cmd中更改。 具体的命令是: lxrun /setdefaultuser rootFound UNIX user: rootDefault UNIX user set to: root lxrun是管

Win10已经支持Ubuntu的Bash了。

在cmd中输入bash就可以进入bash界面。但此时是普通用户登录的。

如果希望更改默认的登录用户,可以在cmd中更改。

具体的命令是:

lxrun /setdefaultuser root
Found UNIX user: root
Default UNIX user set to: root

lxrun是管理bash on win10的工具。可以install、uninstall或update。

lxrun的help信息:

lxrun -h
Performs administrative operations on the LX subsystem

Usage:
    /install - Installs the subsystem
        Optional arguments:
            /y - Do not prompt user to accept
    /uninstall - Uninstalls the subsystem
        Optional arguments:
            /full - Perform a full uninstall
            /y - Do not prompt user to accept
    /setdefaultuser - Configures the subsystem user that bash will be launched as. If the user does not exist it will be created.
        Optional arguments:
            username - Supply the username
            /y - If username is supplied,do not prompt to create a password
    /update - Updates the subsystem's package index

比如安装Bash:

lxrun /install
-- Beta feature --
This will install Ubuntu on Windows,distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms
Type "y" to continue: y
Downloading from the Windows Store... 100%
Extracting filesystem,this will take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: hengwei
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!

比如删除Bash:

lxrun /uninstall
This will uninstall Ubuntu on Windows.
This will remove the Ubuntu environment as well as any modifications and new applications with the exception of:

C:UsershengweiAppDataLocallxsshome
C:UsershengweiAppDataLocallxssroot

Type "y" to continue: y
Uninstalling...

比如更新Bash:

lxrun /update
Checking for updates...
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:3 http://security.ubuntu.com trusty-security/main amd64 Packages [606 kB]
Hit http://archive.ubuntu.com trusty-backports InRelease
......

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读