настройка ssh kali linux

Ethical hacking and penetration testing

InfoSec, IT, Kali Linux, BlackArch

How to enable SSH in Kali Linux. How to connect to Kali Linux via SSH

SSH allows ones to connect to a remote computer and execute commands on it, connecting and transmitting data occurs via an encrypted channel, which is protected from various attacks of interception and data sniffing and spoofing.

SSH includes two programs: a server and a client. The server is installed on a remote machine, to which you need to connect and execute commands on it. The client is designed to connect to a remote machine.

The SSH server acts as a service that listens on port 22 by default. When connecting by default, password authentication is used – you need to enter the user password on the remote Linux system. You can also configure public key based authentication – this option is more convenient (no password is required) and more secure (keys are less prone to brute force).

Speaking about SSH in Kali Linux, you need to consider that this distribution is available in various versions (see details ‘Where to download Kali Linux. What is the difference between Kali Linux versions’): for personal computers, for ARM computers, for mobile phones, for virtual machines. Consider the specific of SSH in Kali Linux for PC and for ARM.

SSH on Kali Linux on ARM computers

Since usually ARM devices are resource-limited computers without a display, you can only manage them by connecting via SSH. For this reason, the SSH service on such devices is already installed and running by default.

In such systems, use a couple as login credentials:

The problem with ARM devices without a screen may be that their IP address is not known, because in most local networks IP addresses are automatically assigned by the DHCP protocol. Typically, routers allow you to view a list of devices and their IP addresses. If you do not have such an opportunity, then IP can be found by scanning the network, for example, with the command:

Instead of _gateway, the Linux operating system will substitute the IP address of your router, as a result, you will get _gateway/24, that is, your local network will be scanned, for example, 192.168.1.0/24. Or, explicitly specify the range for scanning.

SSH in Kali Linux on desktop computers

Kali Linux has already installed the SSH package, but its automatic launch is disabled (like all other network services). Therefore, to connect to Kali Linux via SSH, you need to start this service. If desired, it can be added to auto startup.

There are two options for starting the SSH service:

The second option is more preferred.

To start the SSH service on Kali Linux:

To add a service to startup:

To check the status of a service:

How to connect to Kali Linux via SSH

The command to connect is as follows:

As the IP_ADDRESS of the remote system, you need to specify its IP. You can find out the IP address with the command:

By the way, in order for Kali Linux to always have the same IP address after rebooting, you need to configure a static IP, as described in the article “How to configure Kali Linux to use a static IP address”.

In this case, the Kali Linux IP address is 192.168.1.68. The default user is root. Then the command should be as follows:

But the problem is that in SSH, by default, the authentication via password for the root user is blocked. There are two options to cope the problem:

We will consider both of them, but I recommend the second option, as safer and more convenient.

Why SSH does not accept root password

SSH service configuration is performed in the /etc/ssh/sshd_config file. Let’s open it:

and replace it with:

Save and close the file.

You do NOT need to restart the SSH service, because when you select the ssh.socket option, this service is already stopped and will only be launched the next time you try to connect via SSH.

At the very first connection, the program will display a message:

We type: yes

Then enter the password and we find ourselves in Kali Linux:

The fact that we are in a different system is indicated by the changed command line prompt – now there is the username and host name of the remote system.

How to configure key authentication in Kali Linux (SSH without password)

Disconnect from the remote machine. And on the local machine, execute the command:

Again, without a preliminary connection, we execute the command on the remote machine (change the IP and username to yours):

Now we need to copy the contents of the id_rsa.pub file to the remote machine. It is very simple to do this (do not forget to change the data to your own):

After that, we connect as usual, but the login will no longer require a password:

Источник

HackWare.ru

Этичный хакинг и тестирование на проникновение, информационная безопасность

Как включить SSH в Kali Linux. Как подключиться к Kali Linux по SSH

SSH позволяет подключиться к удалённому компьютеру и выполнить на нём команды, подключение и передача данных происходит по зашифрованному каналу, который защищён от различных атак перехвата и подмены данных.

Читайте также:  как разблокировать приложение заблокированное администратором в windows 10 через командную

SSH включает в себя две программы: сервер и клиент. Сервер устанавливается на удалённую машину, к которой нужно подключиться и выполнить на ней команды. Клиент предназначен для подключения к удалённой машине.

Сервер SSH работает как служба, которая по умолчанию прослушивает 22 порт. При подключении по умолчанию используется аутентификация по паролю — нужно ввести пароль пользователя на удалённой системе Linux. Также можно настроить аутентификацию с помощью ключей — данный вариант является более удобным (не требуется вводить пароль) и более надёжным (ключи менее подвержены брут-форсу).

Говоря о SSH в Kali Linux, нужно учитывать, что данный дистрибутив выпускается в различных вариантах (смотрите подробности «Где скачать Kali Linux. В чём различие версий Kali Linux»): для персональных компьютеров, для ARM компьютеров, для мобильных телефонов, для виртуальных машин. Рассмотрим особенности SSH в Kali Linux для ПК и для ARM.

SSH в Kali Linux в ARM компьютерах

Поскольку обычно ARM устройства представляют собой маломощные компьютеры без монитора, то управлять ими возможно только подключившись по SSH. По этой причине служба SSH на таких устройствах уже и установлена, и запущена по умолчанию.

В таких системах в качестве учётных данных для входа используйте пару:

В некоторых системах также настроен ещё один пользователь: kali / kali

Проблема с ARM устройствами без экрана может заключаться в том, что неизвестен их IP адрес, который в большинстве локальных сетей присваивается автоматически протоколом DHCP. Обычно роутеры позволяют просмотреть список устройств и их IP адреса. Если у вас такой возможности нет, то их можно найти путём сканирования сети, например, командой:

Вместо _gateway операционная система Linux сама подставит IP адрес вашего роутера, в результате получтися _gateway/24, то есть будет просканирована ваша локальная сеть, например, 192.168.1.0/24. Либо явно укажите диапазон для сканирования.

SSH в Kali Linux на настольных компьютерах

В Kali Linux уже установлен пакет SSH, но автоматический его запуск отключён (как и всех других сетевых служб). Следовательно, для подключения к Kali Linux по SSH нужно запустить эту службу. При желании, её можно добавить в автозагрузку.

Есть два варианта запуска службы SSH:

Второй вариант является более предпочтительным. Подробности о первом и втором варианте смотрите в «Полном руководстве по SSH».

Для запуска службы SSH в Kali Linux:

Для добавления службы в автозагрузку:

Для проверки состояния службы:

Как подключиться к Kali Linux по SSH

О том, как подключиться по SSH из различных операционных систем смотрите «Полное руководство по SSH (ч.3) Как подключиться к SSH. Настройка клиента OpenSSH».

Команда для подключения имеет следующий вид:

В качестве IP_АДРЕСа удалённой системы нужно указать её IP. Узнать IP адрес можно командой:

Кстати, чтобы Kali Linux после перезагрузки всегда имела одинаковый IP адрес, нужно настроить статический IP, как это сделать написано в статье «Как настроить Kali Linux на использование статичного IP адреса».

В данном случае IP адрес Kali Linux это 192.168.1.68. Пользователем по умолчанию является root. Тогда команда должна быть следующей:

Но проблема в том, что в SSH по умолчанию заблокирован вход пользователя root по паролю. Вариантов выхода два:

Рассмотрим их оба, но я рекомендую именно второй вариант, как более безопасный и более удобный.

Почему SSH не принимает пароль root

Настройка службы SSH выполняется в конфигурационном файле /etc/ssh/sshd_config. Откроем его:

Сохраните и закройте файл.

Перезапускать службу SSH НЕ нужно, поскольку при выборе варианта ssh.socket эта служба и так отключена и будет запущена только при следующей попытке подключения по SSH.

При самом первом подключении программа выведет сообщение:

В нём у нас спрашивается, действительно ли мы хотим подключиться, набираем: yes

Затем вводим пароль и мы оказываемся в Kali Linux:

О том, что мы в другой системе, говорит изменившееся приглашение командной строки — теперь там имя пользователя и имя хоста удалённой системы.

Как настроить аутентификацию по ключу в Kali Linux (SSH без пароля)

Отключаемся от удалённой машины. И на локальной машине (с которой заходим) выполняем команду:

Опять без предварительного подключения, выполняем команду на удалённой машине (IP и имя пользователя поменяйте на свои):

Теперь нам нужно скопировать содержимое файла id_rsa.pub на удалённую машину. Сделать это очень просто (не забываем менять данные на свои):

После этого подключаемся как обычно, но вход уже не будет требовать пароль:

Источник

How to Enable and Start SSH on Kali Linux

Here at LMG Security, we’re passionate about providing excellent cybersecurity services to organizations around the world. We’re also passionate about increasing cybersecurity awareness through our various training programs. Thanks for visiting our blog and we hope you find this post helpful!

The Linux distribution Kali used by many penetration testers (including those here at LMG Security) recently released version 2017.1 of their rolling release. For quite some time now (Since version 2.0) Kali has used Systemd (System Management Daemon) in place of an init system. This change brought with it a new way of enabling and starting services, even though many still use the old commands, which often still work but may also lead to errors. This post will go over the Systemd method for enabling and starting the SSH (Secure Shell) service on Kali Linux.

The openssh-server package should already be installed, to verify this you can use the following command:

You should see the version with [installed] after it like this:

Читайте также:  поликлиника портовская туапсе адрес

60080/w:600/h:20/q:auto/https://www.lmgsecurity.com/wp-content/uploads/2019/01/openssh_version-300×10.png»/>