Score:1

Kill SSHd Process in Ubuntu

sj flag

..Hi, does anyone know a short script on how to kill sshd for 10 minutes and then back up for 10 minutes continually? Please have mercy on me, I'm a newbie.

Thanks, joe.

user535733 avatar
cn flag
Depends upon the release of Ubuntu that you are running. Please edit your question to include that information.
Score:1
mz flag

You can achieve this with some basic bash scripting. You have to use sleep in order to add a delay, as well as the "while loop", mostly known for being the infinite loop. Example:

nano sshd-loop.sh

while : 
do
    systemctl stop sshd
    sleep 10m 
    systemctl start sshd
    sleep 10m
done

I am no expert on this language but I believe that should work. If you intend to run it on the background you can add &, disown or nohup at the end of sudo bash sshd-loop.sh depending on your needs as each option is different, you can find more information about them here.

If you would like to check the status of the service just run sudo systemctl status sshd

I sit in a Tesla and translated this thread with Ai:

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.