无法使用 ssh 密钥登录新创建的用户

无法使用 ssh 密钥登录新创建的用户

我最近从天蓝色的备份服务器创建了一个新服务器。在该服务器中,我尝试创建一个用户,但未创建用户。

我可以在用户列表中看到该用户,但无法通过 ssh 连接该用户,公钥被拒绝。我检查过,对于该特定用户,未创建主目录,因此未存储 ssh 详细信息供他连接。

我尝试创建一个基于密码的用户。和以前一样,没有创建主目录。

如何解决这个问题?

编辑1:mrc02_kr

root@server:/home/sid# adduser user1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Adding user `user1' ...
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
Adding new group `user1' (1005) ...
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
sent invalidate(group) request, exiting
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
Adding new user `user1' (1005) with group `user1' ...
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
Creating home directory `/home/user1' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for user1
Enter the new value, or press ENTER for the default
    Full Name []: 
    Room Number []: 
    Work Phone []: 
    Home Phone []: 
    Other []: 
sent invalidate(passwd) request, exiting
sent invalidate(group) request, exiting
sent invalidate(passwd) request, exiting
Is the information correct? [Y/n] Y

编辑2:我跑步时发现了这个获取密码

user1:x:1008:1008::/home/user1:
user2:x:1007:1007:,,,:/home/user2:/bin/bash

我可以登录 user1 但不能登录 user2

相关内容