For some reason, the SSH server is not starting on boot. I have to manually start it using the this command:
sudo service ssh start
I haven't modified anything related to the ssh configuration. How do I get it to start automatically on boot?
For some reason, the SSH server is not starting on boot. I have to manually start it using the this command:
sudo service ssh start
I haven't modified anything related to the ssh configuration. How do I get it to start automatically on boot?
sudo systemctl enable sshd.service
When I try that command I get this error:
raspberrypi:~$ sudo systemctl enable sshd.service
Failed to execute operation: No such file or directory
May I ask:
Sure.
Version 16.04.2 LTS
I haven’t modified ssh yet at all since install.
Yeah, I’ve done apt-get install openssh-server and can confirm it’s installed. It came with mate.
My apologies, didn’t notice this was in Raspberry Pi area. I assumed UM on Raspberry Pi uses systemd as well. Looks like that’s not the case. You can check, of course:
sudo stat /proc/1/exe -c ' File: %N'
should tell you what init system is in use. Reply should be one of the three:
File: '/proc/1/exe' -> '/lib/systemd/systemd'
File: '/proc/1/exe' -> '/sbin/init'
File: '/proc/1/exe' -> '/sbin/upstart'
Since you can start the service manually with service command, it’s either sysvinit or Upstart (which can run syvinit scripts as well - so it’s a bit confusing). Assuming your system is using Upstart you could try:
sudo update-rc.d ssh defaults
and then reboot.
The output is actually the first one...
'/lib/systemd/systemd'
Can you please provide the output of the command:
ps axu | grep [s]sh
andy@andy-raspberrypi:~$ ps axu | grep [s]sh
andy 1199 0.0 0.0 3000 216 ? Ss 11:48 0:00 /usr/bin/ssh-agent -s
Thanks, how about:
ls -alh /etc/ssh/sshd_config
That's really odd. Installing openssh-server package should install the systemd unit file (/lib/systemd/system/ssh.service) and the necessary config files. Vendor default is "enabled" so it's (or should be) just a question of installing the package and you're good to go.
If systemctl status sshd.service gives you this error as well, then I guess the lazy man's solution is to simply re-install openssh-server, preferably in terminal with apt-get so you get to see possible errors.
Please let us know how it goes. I'm off for a couple of hours but will check this thread when I come back (and there are others here to help you).
Output:
andy@andy-raspberrypi:~$ ls -alh /etc/ssh/sshd_config
-rw-r--r-- 1 root root 2.5K Feb 11 13:21 /etc/ssh/sshd_config
I've removed openssh-server and reinstalled it with no luck.
sudo apt-get remove openssh-server
sudo apt-get install openssh-server
I still get the No such file or directory error.
andy@andy-raspberrypi:~$ sudo systemctl status sshd.service
â—Ź sshd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Can you please remove again then use:
sudo apt install ssh
Ok, something just occured to me. Can you please try with ssh.service, not sshd.service:
sudo systemctl status ssh.service
This, of course, with openssh-server package installed. Also, what is the output of:
ls -la /etc/systemd/system/ssh*.service
Explanation: the unit file in /lib/systemd/system is ssh.service, not sshd.service. It does contain directive Alias=sshd.service, but I noticed that doesn’t necessarily work if the symbolic link in /etc/systemd/system is ssh.service, not sshd.service.
Old dogs like me automatically think “with D”, since it’s a daemon, not a client we are talking about here.
If you got status with ssh.service, you can use that to enable ssh daemon at boot:
sudo systemctl enable ssh.service
Thanks, this fixed it for me.
Good afternoon all,
I have installed UBUNTU Mate on my RasPi 3 with WiFi and working relatively fine, relatively is because I cannot connect to the server via SSH (yes SSH is enabled) unless I physically logged ito the server, which is not at all convenient, it is a bit of a leg work going up the stairs when rebooting etc.
Is there any way that the configuration files execute automatically after reboot please without logging in? I am trying to use it as VPN Server if it does not load the configuration files then VPN Server cannot work at all. (I have installed VPN Server on UBUNTU somewhere else and it works fine).
Cheers
Siamak
I’ve never encountered this problem - possibly because I have my system set to login automatically on boot, so the circumstances don’t occur.
Derek