Par*_*dox 27 linux users ubuntu linux-mint
我正在尝试根据此处的建议更改我的用户名,但是在运行以下命令后:
CurrentName@HostName ~ $ sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
Run Code Online (Sandbox Code Playgroud)
终端响应:
CurrentName@HostName ~ $ usermod: user CurrentName is currently used by process 2491
Run Code Online (Sandbox Code Playgroud)
并且用户名保持不变。有谁知道我如何解决这个问题并更改我的用户名?
seu*_*mac 15
引用man usermod:
CAVEATS
You must make certain that the named user is not executing any
processes when this command is being executed
if the user's numerical user ID, the user's name, or the user's home
directory is being changed. usermod
checks this on Linux, but only check if the user is logged in
according to utmp on other architectures.
Run Code Online (Sandbox Code Playgroud)
因此,您需要确保您重命名的用户未登录。
另外,我注意到您没有以 root 身份运行它。要么以 root 身份运行它,要么使用“sudo usermod”运行。
小智 8
尝试以下步骤:
sudo passwd root
Run Code Online (Sandbox Code Playgroud)
root开机后登录。这将允许 Ubuntu 不为当前用户生成任何进程。usermod -l newuser -d /home/newuser -m olduser
Run Code Online (Sandbox Code Playgroud)
/home。与其手动编辑您知道的文件(糟糕),或打开root密码(非常糟糕),只需使用at. 阅读,并使用( )man at的完整路径:usermodtype -p usermod
sudo at "now +5 minutes"
your usermod command goes here
^D
Run Code Online (Sandbox Code Playgroud)
^D是Ctrl-D
然后,快速注销,等待 7 分钟,然后登录。