LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cant ssh into Centos7 virtualbox after changing run level (https://www.linuxquestions.org/questions/linux-newbie-8/cant-ssh-into-centos7-virtualbox-after-changing-run-level-4175618270/)

goblin_rocket 11-24-2017 12:09 AM

Cant ssh into Centos7 virtualbox after changing run level
 
I was making some changes to the run level in a Centos7 VM in Virtualbox, I changed it to run level 0 but then changed it back to 3 and restarted but I am now unable to ssh into it remotely.

I have verified that the runlevel is back at 3 and rebooted several times now and still cant ssh in with any user, it just time out every time.

thanks

TheEzekielProject 11-24-2017 02:21 AM

Have you tried adding the -v option to your ssh attempts???


Try -vvv for more output!

EDIT: That's three (3) lower case V's

AwesomeMachine 11-24-2017 03:40 AM

Just check the VM to see if the networking and ssh processes are running.

goblin_rocket 11-24-2017 05:58 AM

this is the -vvv output

$ ssh root@192.168.1.52 -vvv
OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "192.168.1.52" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.1.52 [192.168.1.52] port 22.
debug1: connect to address 192.168.1.52 port 22: Connection timed out
ssh: connect to host 192.168.1.52 port 22: Connection timed out


I will check VM settings now

michaelk 11-24-2017 07:39 AM

How is the VM network adapter configured?

Are you using the correct IP address?

The firewall default allows ssh traffic so if it was running you should be able to connect.

Just as an FYI run levels in systemd are "obselete". An equivalent is:
0 = poweroff.target
1 = rescue.target
2,3,4 = multiuser.target
5 = graphical.target
6 = reboot.target

goblin_rocket 11-24-2017 07:43 AM

Quote:

Originally Posted by michaelk (Post 5784593)
How is the VM network adapter configured?

Are you using the correct IP address?

The firewall default allows ssh traffic so if it was running you should be able to connect.

Just as an FYI run levels in systemd are "obselete". An equivalent is:
0 = poweroff.target
1 = rescue.target
2,3,4 = multiuser.target
5 = graphical.target
6 = reboot.target

I have the network adapter setup as a bridge adapter, but I havent changed anything at all in the VMBox settings. All I did was do 'init 0' and then I changed that back later to 3 but now cant get back in, checked /etc/inittab and also /sshd_config and I cant see anything in those that could be stopping me from ssh-ing into the box now....

michaelk 11-24-2017 08:04 AM

Running the command init 0 should of powered off the VM. No settings were changed.

You can check ssh status via the command.
systemctl status sshd

You can also verify ssh is working within the VM by trying to login to itself.

ssh localhost

scasey 11-24-2017 10:32 AM

My guess is that sshd is not running. Probably it was set up and started, but not "enabled," so it doesn't start at boot.
Clue is "Connection Timed Out" -- means there's no daemon listening on port 22.

Just a guess, tho. What does
Code:

ss -tnl
show?

goblin_rocket 11-25-2017 07:55 PM

Quote:

Originally Posted by michaelk (Post 5784601)
Running the command init 0 should of powered off the VM. No settings were changed.

You can check ssh status via the command.
systemctl status sshd

You can also verify ssh is working within the VM by trying to login to itself.

ssh localhost

you were right it was the ip, I have two boxes on ips ending 54 and 55 but they seem to have changed to 57 and 58 so I guess I didnt setup the static ips correctly.

Solved, thank you!


All times are GMT -5. The time now is 08:27 PM.