[SOLVED] Cant ssh into Centos7 virtualbox after changing run level
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
$ 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
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
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....
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.