This siteAll blogsLe 17ClémentCCBCuisineLe 3ContactSe connecterS'inscrire
  • All blogs
  • Le 17
  • Clément
  • CCB
  • Cuisine
  • Le 3
  • Contact

  • S'inscrire

Recettes informatiques

  • Page de garde
  • Contact
  • Se connecter
  • « Example of fork and respawn
  • Create a git mirror »

Start SSH daemon on Git portable distribution

Posted by mazet on 02 Jun 2021 in Bash, Systeme

Shell

#!/bin/sh
 
if [ "$1" = "-h" ]; then
    # help message
    echo "usgage: $(basename $0) [-h|-s|-x]"
    echo " -h: help message"
    echo " -s: start daemon"
    echo " -x: kill daemon"
    exit 0
 
elif [ "$1" = "-s" ]; then
    # generate keys
    for type 
    [ -f  /etc/ssh/ssh_host_dsa_key ] || ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
    [ -f  /etc/ssh/ssh_host_ecdsa_key ] || ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key
    [ -f  /etc/ssh/ssh_host_ed25519_key ] || ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key
    [ -f  /etc/ssh/ssh_host_rsa_key ] || ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
 
    # start daemon
    ps aux | grep -q sshd || /bin/sshd
 
elif [ "$1" = "-x" ]; then
    # kill daemon
    kill -9 $(ps aux | awk '/sshd/ {print $1}')
 
elif [ "$1" = "" ]; then
    # status
    ps aux | awk '/sshd/ {print}'
 
else
    # error
    echo "unknown argument ($1)"
    exit 1
fi
This entry was posted by mazet and filed under Bash, Systeme.

Aucun commentaire pour le moment

Catégories

  • Toutes
  • Non catégorisé
  • Programmation
    • Awk
    • Bash
    • C
    • C++
    • Javascript
    • LaTeX
    • Perl
    • Tcl/Tk
  • Systeme
    • Android
    • Debian
    • Ubuntu

Contenu

  • Creating a network between 2 virtual machines on Windows with Qemu
  • Build a Debian package for pdmenu
  • Extract informations from epub file
  • Connexion PostgreSql / Java par Socket Unix
  • Example of fork and respawn
  • Start SSH daemon on Git portable distribution
  • Create a git mirror
  • Color diff
  • Create on Debian a Minecraft server
  • GIT/HG/SVN on multiple repos simultaneously
  • Convert Comics into CBZ format
  • Random password generator function
  • Convert to camelCase
  • DKIM and SPF
  • Migration from BackupPC 3 (Debian package) to BackupPC 4 (Standalone Installation)
  • Minimal BC for Mingw
  • Diskless Debian cluster
  • Colorize log file
  • Generate certificates with (or without) a certificate authority
  • Install Mercurial (hg) on Android
Mai 2025
Lun Mar Mer Jeu Ven Sam Dim
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
 << <   > >>
  • Accueil
  • Récemment
  • Archives
  • Catégories
  • Derniers commentaires

Rechercher

Flux XML

  • RSS 2.0: Posts
  • Atom: Posts
What is RSS?

©2025 by Laurent Mazet • Contact • Aide • b2evolution CCMS

Blog software

Cookies are required to enable core site functionality.