Can't connect using ssh after enabling it on Kali Linux using the root user and password

13,982

To install SSH on Linux using terminal

To see if ssh is installed on Linux (the client) to see if it is installed on the computer type:

ssh 

See If SSH Client Is Installed

To see if ssh server is installed on the Linux system type:

ssh local host

local host (is the loopback IP address, the IP address that the computer uses to talk to the same Linux OS)

SSH Local Host

To install ssh server type:

sudo apt-get install openssh-server

Install SSH Server

To see if the ssh server is active type this:

sudo service ssh status

To See if SSH Server Is Active

type Ctrl+c after this if the terminal won't let you type anything now.

If the server is active you can type this command to start it:

sudo service ssh start

enter image description here

Then you can use this command to to see if it is now active:

sudo service ssh status

See If SSH Server Is Active

Type Ctrl+c after this if the terminal won't let you type anything now.

and to stop the SSH server you can type this if want to stop it sometime:

sudo service ssh stop

you can also check the status using this command to make sure it stopped:

sudo service ssh status

If you are using Virtual Box and need to type Ctrl+c, make sure you hold down the Ctrl button and then type c while still holding Ctrl; Virtual Box uses this key as default as the host key so you might have to try the other Ctrl button on the keyboard if this is not working.

Share:
13,982

Related videos on Youtube

SuperUserJL
Author by

SuperUserJL

Updated on September 18, 2022

Comments

  • SuperUserJL
    SuperUserJL over 1 year

    I have enabled SSH and Port forwarded on my router to port 22 and I can't login as root user and password using putty it says access denied, and I can't connect to it using the same linux OS using the root user and password. It says Permission denied, please try again.

    Can someone please let me know what I need to do to connect?

    SSH Can't Connect

    • Kamil Maciorowski
      Kamil Maciorowski over 5 years
      Is there PermitRootLogin line in sshd_config of the SSH server? What does the line say?
    • tvdo
      tvdo over 5 years
      Also, "port forwarding" is entirely unnecessary if you're only connecting from within the same network. The only reason you'd ever do that is if you needed to be able to connect over the internet, i.e. remotely.
    • SuperUserJL
      SuperUserJL over 5 years
      I edited the PermitRootLogin using sudo gedit and I changed "#PermitRootLogin prohibit-password" to "#PermitRootLogin yes" but I think I forgot to remove the # so that might be why I followed this link linuxconfig.org/…
    • SuperUserJL
      SuperUserJL over 5 years
      I didn't know that bob. That's good to know. Thanks for the information!
    • SuperUserJL
      SuperUserJL over 5 years
      I found a way to connect. The SSH server was not enabled.
    • djsmiley2kStaysInside
      djsmiley2kStaysInside over 5 years
      @SuperUserJL feel free to answer your own question, with how you figured it out and how you started SSH. It may help others in the future with the same problem!.