Score:-1

How to Control the SSH Service

my flag

Ubuntu 20.04.

I have installed the openssh-server to test with ssh, but since then, whenever I boot up the system, the server starts running at port 22, which I feel is a security risk when I am connected with WiFi (and maybe it even hogs a lot of RAM).

So my questions are

  • How to control from the terminal whether the service starts at boot. I understand it has something to do with systemd, but somewhat of a noob to know it. Basically what commands add or remove it from starting at booting?
  • When the machine is powered on, what commands can start, stop, restart the service? I can kill the process by sending a signal, but wonder whether that is really a graceful exit.
muru avatar
us flag
Does this answer your question? [How to enable or disable services?](https://askubuntu.com/questions/19320/how-to-enable-or-disable-services)
muru avatar
us flag
`systemctl disable ssh`, `systemctl [start|stop|restart] ssh`
Score:0
ro flag

You can disable (so it doesn't start at boot) the service with

sudo systemctl disable ssh.service

then start it when needed with

sudo systemctl start ssh.service

To change the port edit

/etc/ssh/sshd_config

The file has a commented port line

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.