配置SSH连接

 

准备工作

要配置远程登录Kali Linux,首先我们需要更改默认的root密码并生成新的SSH密钥。

 

作者:

锦凡歆在 ‘来疯’ 直播唱歌最好听

 

怎么做

使用passwd命令修改root密码

  1. root@osboxes:~# passwd
  2. Enter new UNIX password: 
  3. Retype new UNIX password: 
  4. passwd: password updated successfully
  5. root@osboxes:~# 

重新配置SSH主机密钥非常简单,首先删除当前的SSH主机密钥,然后使用dpkg-reconfigure openssh-server命令重新生成密钥即可。

  1. root@osboxes:~# rm /etc/ssh/ssh_host_*
  2. root@osboxes:~# dpkg-reconfigure openssh-server 
  3. Creating SSH2 RSA key; this may take some time ...
  4. 2048 SHA256:1FN10l0k50Ng/dpeLIXTPmFGyupZB22hk4JNQC1aKcI root@osboxes (RSA)
  5. Creating SSH2 ECDSA key; this may take some time ...
  6. 256 SHA256:37c9q4AwOW4wEwUoEpQ1Jz/KXIYJfV53ORWeGBzONdI root@osboxes (ECDSA)
  7. Creating SSH2 ED25519 key; this may take some time ...
  8. 256 SHA256:ky1bOQlbMFIMB0si0w7Msv32fpSeza6lZeHn8OevGdU root@osboxes (ED25519)
  9. rescue-ssh.target is a disabled or a static unit, not starting it.

我们还需要编辑OpenSSH服务配置文件:/etc/ssh/sshd_config,将#PermitRootLogin without-password 更改为PermitRootLogin yes,从而运行root远程登录。

配置SSH连接_第1张图片

若要设置SSH服务开机启动,则执行systemctl enable ssh即可

  1. root@osboxes:~# systemctl enable ssh
  2. Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
  3. Executing: /lib/systemd/systemd-sysv-install enable ssh
  4. Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.

Tip:最好是将远程登录配置为密钥登录,而不是使用密码。

 

你可能感兴趣的:(工具)