Enabling sshd from within a chroot
by dlanced from LinuxQuestions.org on (#55BAK)
Ok. I may be making this way too complicated, but I'm trying to run Kali Linux as a VM on VirtualBox. It installed without trouble, but when I run it, it boots to a black screen. I've read that Kali doesn't play nicely with all graphics drivers (my host is running Radeon). I tried adding a Code:radeon.modeset=0 parameter to the GRUB code, but that didn't help.
The thing is that I don't need a GUI desktop here, and Kali itself will launch nicely under headless mode in VirtualBox. The other thing, though, is that Kali's default is to disable SSH server.
So I attached the Kali VDI disk to a different VirtualBox VM and booted it. I then created a chroot mount and installed openssh-server. But that didn't actually start (or enable) the service, and systemctl enable won't run under a normal chroot environment. So I copied the contents of the /etc/systemd/system/sshd.service file from a different system and pasted them into the chroot version of the directory. Since the file permissions are supposed to look like this:
Code:lrwxrwxrwx 1 root root 31 Mar 19 2019 sshd.service -> /lib/systemd/system/ssh.service...I fixed them and created a symlink to /lib/systemd/system/ in the chroot. I also enabled password login in the /etc/ssh/sshd_config file.
But it's still no go. nmap shows me the Kali box is running, but the SSH port is shut tight. Any ideas?


The thing is that I don't need a GUI desktop here, and Kali itself will launch nicely under headless mode in VirtualBox. The other thing, though, is that Kali's default is to disable SSH server.
So I attached the Kali VDI disk to a different VirtualBox VM and booted it. I then created a chroot mount and installed openssh-server. But that didn't actually start (or enable) the service, and systemctl enable won't run under a normal chroot environment. So I copied the contents of the /etc/systemd/system/sshd.service file from a different system and pasted them into the chroot version of the directory. Since the file permissions are supposed to look like this:
Code:lrwxrwxrwx 1 root root 31 Mar 19 2019 sshd.service -> /lib/systemd/system/ssh.service...I fixed them and created a symlink to /lib/systemd/system/ in the chroot. I also enabled password login in the /etc/ssh/sshd_config file.
But it's still no go. nmap shows me the Kali box is running, but the SSH port is shut tight. Any ideas?