Установка ssh kali linux

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»/>

About the Author

Источник

Статья Включение SSH на Kali Linux

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

1) Установка сервера OpenSSH
Первый шаг — идём в окно терминала и устанавливаем сервер OpenSSH. Это делается выполнением следующей команды:

У меня выдало вот такое сообщение, в любом случае, продолжаем:

2) Настраиваем SSH для постоянной работы. Другими словами, для сохранения после перезагрузки.
a) Сначала нам нужно удалить уровень выполнения для SSH следующей командой:

3) Меняем дефолтные SSH ключи
Теперь нам нужно заменить дефолтные SSH ключи. Причина этого в том, что каждый Linux и Unix дистрибутив имеют схожие ключи. Потенциально, атакующие могут угадать и взломать ваши SSH ключи и эксплуатировать вашу систему используя техники человека-по-середине.

a) Бэкапим и удаляем дефолтные ключи Kali Linux

b) Создаём новые ключи

Печатаем следующую команду в терминальном окне:

4) MOTD – Message of the Day banner (приветственный баннер)
Вы можете создать приветственный баннер, также известный как Message of the Day (MOTD) на Kali Linux, который показывается когда пользователи входят.

Просто отредактируйте файл /etc/motd (перезапустите ssh после того, как вы завершили редактирование).

Отредактируйте этот файл и вставьте ваш текст.

для графического интерфейса редактирования файла используйте vim -g /etc/motd)

a) MOTD – Сообщение приветственного баннера

Лично мне нравятся делать приветствие из ASCII картинки. Идём сюда для создания вашей собственной картинки ASCII

Мы добавили следующий текст в приветственный баннер:

Видим, что SSH входит в чёрный список. Поэтому открываете этот файл /usr/sbin/update-rc.d

Pirnazar

The Codeby

ООО Кодебай

KREIZ
29.08.2015 в 04:23
не получилось. после установки sshd уже был в системе, только приходилось включать руками. после выполнения п.2 – перестал даже включаться. что делать теперь?

WEBWARE TEAM
29.08.2015 в 18:12
Дополнено для Kali 2.0.

J.D.
07.04.2016 в 14:15
На 2016.1 включается командой update-rc.d -f ssh remove && update-rc.d ssh enable . Для тех, у кого с этим трудности

ALEX1917
06.01.2017 в 03:44
Здравствуйте, помогите решить проблему следующего характера: Поставил Kali LXSD Работала нормально, но потом что-то случилось, и как выключю пк, чтобы снова сесть за компьютер ставлю её заново, т.к. после установки, обновления держу в аптайме по мере возможности, у меня один компьютер сгорел, еле набрал средств на новый, опасаюсь! Ранее включал и выключал и веб-браузеры не исчезали, а так же все приложения исчезают, соответственно терминала тоже нет, а в меню приложений остается 2 пункта. 1) Выйти; 2) Выполнить. Поставил старого гнома 2016(1) Дал команду обновится, но в конце выходит это, чтобы я не делал:

KREIZ
30.08.2015 в 12:02
спасибо, но не помогло. найдется альтернативный вариант – отпишусь.

Читайте также:  Tightvnc server ��������� linux

MADDOG719
02.09.2015 в 12:36
Привет, помоги плиз, одна надежда на Вас)) вообщем не могу запустить ssh на Kali 2.0 все сделал как указано в статье, но не работает. Показывает следующую ошибку:

Очень надеюсь на Вашу помощь. В любом случае большое спасибо)

WEBWARE TEAM
02.09.2015 в 14:39
Ошибку вижу, а что вы делаете чтобы получить эту ошибку? Неужели на чистой системе просто ввели команды из этой статьи и всё сломалось?

Это у вас, наверное, вывод по systemctl status ssh. Выводит ли что-нибудь sshd -t?

Вносились ли изменения в файл /etc/ssh/sshd_config ? Добавляли ли сетевые интерфейсы? Работаете под рутом? Не прослушивает ли другая программа порт 22 или не меняли ли стандартный порт?

В файле /etc/ssh/sshd_config директива ListenAddress у вас закомментирована? Если нет, попробуйте закомментировать и запустить.

MADDOG719
02.09.2015 в 15:19
Огромное спасибо, закоментировал строчку, и врое как запустился.

EMIL
22.09.2015 в 13:27
не помогло. все отлично работает только при рестарте ssh не запускаеться автоматически

сделал ssh enable так как сказано. не помог

EMIL
22.09.2015 в 14:04
все решил. rcconf И там поставил галочку на ssh. дальше reboot и все работает.

ZEMLIA-ZEMLIA
05.12.2015 в 23:13
Не пускало после выполнения данных действий, посмотрел конфиг ssh (а настраиваю kali 2.0 )

там стоит по умолчанию PAM аутентитификация, и к ней включен параметр PermitRootLogin without-password

и закоментирован параметр PasswordAuthentication yes

Поэтому при попытке подключиться пишет пермишен денайт

надо соответствено PermitRootLogin without-password закоментировать

и PasswordAuthentication yes раскоментировать )

COBRA HACKING
01.06.2016 в 13:26
MAdDog719, эту у вас ssh ругается на то что включен без парольный вход под учеткой root

Источник

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:

  • User: kali
  • Password: kali

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:

Читайте также:  Rar archiver mac os

Or by 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:

  • ssh.service – SSH service will always be running
  • ssh.socket – the system will open port 22 for listening and will wait for a connection to it. If connection happened, the system will start the SSH service. For the rest of the time (when there is no SSH connection), the SSH service will be stopped and will not consume system resources.

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:

  • authentication via password for root
  • configure authentication with keys

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:

Источник

Оцените статью