学好Linux的每一课 2018-11-10 22:53:58
强调:在Linux当中,创建一个用户必须使用两个命令,一个是useradd创建用户,另一个是passwd为用户设置密码。
A:useradd命令的使用
useradd -g 组名 新建用户名
作用:添加新用户
B:passwd命令的使用
作用:设置用户密码
例:
1、第一步在/home目录下,创建一个新用户zhangsan,然后利用ls -l命令查看新创建的用户的详细内容
这时虽然创建了一个用户,但是创建用户的工作依然没有完成,还没有为用户设置密码,为什么不设置密码就代表没有完成呢?
原因就是我们首先将窗口切换到windows界面
我们知道在windows中要想实现远程对ubutu的虚拟机进行管理,需要通过xshell客户端进行管理,双击进入。
可以看到有一个新建会话,连接到远程主机,现在我们想用我们新建的账号zhangsan远程连接到我们的远程主机上
找到用户身份验证,然后将用户名和密码删除点击确定
这时候用户名已经没有了,我们可以点击连接
这时输入zhangsan的用户名
一看需要用户的密码,不知道,所以创建一个用户就必须为这个用户创建密码才能说完成了用户创建。
这时候我们在切换到windows界面
说明我们已经成功通过远程终端实现了远程控制ubutu虚拟机,然后通过exit退出客户端。