How Do I Restart the Ssh Service?

How do I stop/start ssh? I've tried

/etc/init.d/ssh restart
sudo service ssh restart
sudo restart ssh

I get errors every time.

1

7 Answers

15.04 and newer:

Use this command:

sudo systemctl restart ssh

To restart the SSH server/daemon.

Going forward with systemd starting with Ubuntu 15.04, you now use this syntax to stop, start, or restart services:

sudo systemctl <action> <service-name>
3

Command for restart ssh service is:

sudo service ssh restart
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.