How do I restart ssh or sshd on Ubuntu?

Install openssh-server

sudo apt-get install openssh-server

The sshd is the ssh server deamon. So if you want to connect to a machine via ssh you need to install a ssh server on your target machine, e.g. using

sudo apt-get install openssh-server

The command ssh is what you use to actually connect to a machine running an ssh server. You need ssh installed on the machine that you want to ssh from.

sudo apt-get install ssh

But ssh will probably already be installed if you use any decent version of Ubuntu.


Now about restarting. What do you want to restart? If you want to restart the ssh server on the other machine (e.g. if you changed the config) use

sudo /etc/init.d/ssh restart

Yes it is called ssh although the process is called sshd which might be confusing.