Linux 如何在 Ubuntu 中添加用户?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I add a user in Ubuntu?
提问by quackingduck
Specifically, what commands do I run from the terminal?
具体来说,我从终端运行哪些命令?
采纳答案by quackingduck
Without a home directory
没有主目录
sudo useradd myuser
With home directory
带主目录
sudo useradd -m myuser
Then set the password
然后设置密码
sudo passwd myuser
Then set the shell
然后设置外壳
sudo usermod -s /bin/bash myuser
回答by skinp
There's basicly 2 commands to do this...
基本上有2个命令可以做到这一点......
- useradd
- adduser (which is a frendlier front end to useradd)
- 用户地址
- adduser(这是 useradd 的一个更友好的前端)
You have to run them has root. Just read their manuals to find out how to use them.
你必须运行它们有root。只需阅读他们的手册以了解如何使用它们。
回答by Liberty
Here's the command I almost always use (adding user kevin):
这是我几乎总是使用的命令(添加用户 kevin):
useradd -d /home/kevin -s /bin/bash -m kevin