所以问题是我可以使用以下命令登录到服务器上
: ssh root@SERVER_IP_ADRESS
但是当我尝试使用从root用户创建的用户登录时
ssh USERNAME@SERVER_IP_ADRESS5
我得到:
我之前完成的步骤。
SSH生成了一个密钥 使用给定的SSH密钥创建了Ubuntu 16.04 Droplet。 通过root SSH进入服务器
$ adduser username
usermod -aG sudo username
`$ ssh -vvv root@serverip
OpenSSH7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/sshconfig
debug1: /etc/ssh/sshconfig line 48: Applying options for *
debug2: sshconnectdirect: needpriv 0
debug1: Connecting to cleanproject port 22.
debug1: Connection established.
debug1: identity file /Users/happy/.ssh/idrsa type 0
....
...
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/happy/.ssh/id_dsa
debug3: no such identity: /Users/happy/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /Users/happy/.ssh/id_ecdsa
debug3: no such identity: /Users/happy/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/happy/.ssh/id_ed25519
debug3: no such identity: /Users/happy/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
答案 0 :(得分:0)
以下步骤应有助于在实例上创建和验证新用户。
$ sudo adduser test123
$ sudo su test123
$mkdir .ssh
$ chmod 700 .ssh
$pwd
是/ home / test123 在.ssh文件夹中,执行这些操作
$ touch authorized_keys
$ chmod 600 authorized_keys
从本地系统在此处粘贴您的公共密钥,如果在保存时未编辑,则id_rsa.pub是默认名称。确保没有多余的空格被复制。
应该可以!!
$ssh test123@ip-address