Skip to content

SSH Login ohne Passwort

Angeheftet Linux
  • Wird Zeit das man den Artikel hier mal vernünftig macht, habe deswegen gestern drei Stunden verplempert, weil vermutlich wg. der Hitze, der Groschen nicht fallen wollte 🙂

    Server

    Installation des Dienstes

    apt install openssh-server
    

    In der Datei /etc/ssh/sshd_config wird der SSH-Dienst gesteuert. Die Zeile, die uns interessiert.

    PermitRootLogin without-password
    

    Was bedeutet das jetzt?

    • without-password Der Passwort-Login für Root ist deaktiviert, dann kann man sich nur mittels SSH-Key einloggen, wenn dieser hinterlegt wurde.

    PermitRootLogin
    Specifies whether root can log in using ssh(1). The argument must be “yes”,
    “without-password”, “forced-commands-only”, or “no”. The default is “yes”.

    If this option is set to “without-password”, password authentication is disabled for
    root.

    If this option is set to “forced-commands-only”, root login with public key
    authentication will be allowed, but only if the command option has been specified
    (which may be useful for taking remote backups even if root login is normally not
    allowed). All other authentication methods are disabled for root.

    If this option is set to “no”, root is not allowed to log in.

    Quelle: http://manpages.ubuntu.com/manpages/trusty/en/man5/sshd_config.5.html

    Datei bearbeiten und dann den Dienst einmal neustarten

    service sshd restart
    

    oder

     /etc/init.d/ssh restart
    

    Client

    Wir erzeugen einen Key mit

    ssh-keygen -t rsa -b 4096
    

    Dann kopieren wir diesen Key auf das Zielsystem. Das geht aber nur, wenn

    PermitRootLogin yes
    

    steht. Also vorher auf dem Server umstellen und den Dienst neustarten!

    Key kopieren

    cat .ssh/id_rsa.pub | ssh username@domain.com 'cat >> .ssh/authorized_keys'
    

    Fertig!

    Danach auf dem Server wieder auf

    PermitRootLogin without-password
    

    umstellen. Ganz wichtig!!

  • Wenn das mal nicht geht, ist der Ordner .ssh auf dem Ziel/Quelle nicht vorhanden.

    Dann auf dem Ziel/Quelle

    ssh-keygen -t rsa
    

    ausführen, danach geht es.

  • Ich habe heute den Ursprungsbeitrag mal vernünftig aktualisiert, weil ich gestern drei Stunden bei dem Testen von sshfs verplempert habe. Zu sshfs kommt auch noch ein Beitrag 😉

  • Wie ihr ja wisst, benutze ich das Forum hier auch gerne als Notizbuch 🙂 Also mal wieder was hier notieren. Mein Windows Systemadmin sagte mir heute, das es auch folgendes gibt

    # ssh-keygen -t ed25519
    Generating public/private ed25519 key pair.
    Enter file in which to save the key (/root/.ssh/id_ed25519): /tmp/ed
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /tmp/ed
    Your public key has been saved in /tmp/ed.pub
    The key fingerprint is:
    SHA256:D33HCTW7Dy0p5kQdFTkPudx1PQh0EHFgkBvxy8KwhGM root@frank-ms7c92
    The key's randomart image is:
    +--[ED25519 256]--+
    |         o=O*o=+=|
    |      .  oo o+oB+|
    |     E o  o.o.o+*|
    |    . o +o...oo=o|
    |       .So.o= O .|
    |         o.= o + |
    |          . .   .|
    |                 |
    |                 |
    +----[SHA256]-----+
    

    Der Key liegt nur in /tmp kopieren lohnt also nicht 🙂

    Ob das jetzt die Zukunft ist, kann ich nicht beantworten. Ich wollte es aber hier mal festhalten, weil es wohl mittlerweile auch von vielen Projekten benutzt wird.

  • FrankMF FrankM hat am auf dieses Thema verwiesen

  • Zima Board

    Linux
    6
    0 Stimmen
    6 Beiträge
    655 Aufrufe
    FrankMF

    Wer noch einen braucht, sind wieder ein paar im Shop erhältlich.

    ZimaBoard 832 is IN STOCK & AVAILABLE NOW
    ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌
    ZimaBoard Official Store

    Back In Stock

    The item you've been waiting for is back in stock

    ZimaBoard 832 - Single Board Server for Creators

    $199.90

    Model: ZimaBoard 832

    Stock: 190

  • LUKS Key Derivation Function

    Linux
    1
    0 Stimmen
    1 Beiträge
    52 Aufrufe
    Niemand hat geantwortet
  • Star64 lieferbar

    Star64
    1
    0 Stimmen
    1 Beiträge
    53 Aufrufe
    Niemand hat geantwortet
  • Storage Box für den REST-Server

    Restic
    1
    0 Stimmen
    1 Beiträge
    124 Aufrufe
    Niemand hat geantwortet
  • ZFS - One Disk Pool -> Mirror Pool

    Linux
    1
    0 Stimmen
    1 Beiträge
    140 Aufrufe
    Niemand hat geantwortet
  • Kopia - HTTP/S Server aufsetzen

    Angeheftet Kopia
    1
    0 Stimmen
    1 Beiträge
    348 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    12 Beiträge
    3k Aufrufe
    FrankMF

    Da btrfs bei mir ja nicht so der Bringer war, Fehler im Image vom Kamil?, Fehler in btrfs? Ich weiß es nicht, also weg damit! Da ich das NAS noch richtig produktiv genutzt hatte, waren die Daten schnell gesichert. Danach das NAS neugestartet, nun sind die beiden Platten nicht mehr gemountet und wir können damit arbeiten.

    ACHTUNG! Ich bitte wie immer darum, das Gehirn ab hier einzuschalten! Sonst droht Datenverlust! Aus Sicherheitsgründen gebe ich hier die Laufwerke so an = sdX1 Das X bitte entsprechend austauschen!

    Die beiden Platten mit

    sudo fdisk /dev/sdX

    neu einrichten. Alte Partition weg, neu einrichten usw. Im Detail gehe ich hier jetzt nicht drauf ein. Ich gehe davon aus, das das bekannt ist.

    Der Plan

    raid_pool0 = sdX1 = /dev/mapper/raid_pool0
    raid_pool1 = sdX1 = /dev/mapper/raid_pool1

    Verschlüsseln sudo cryptsetup --key-size 512 --hash sha256 --iter-time 5000 --use-random luksFormat /dev/sdX1 sudo cryptsetup --key-size 512 --hash sha256 --iter-time 5000 --use-random luksFormat /dev/sdX1 Platten entschlüsseln sudo cryptsetup open /dev/sdX1 raid_pool0 sudo cryptsetup open /dev/sdX1 raid_pool1 RAID1 anlegen sudo mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/mapper/raid_pool0 /dev/mapper/raid_pool1 sudo mkfs.ext4 /dev/md0 Script zum Entschlüsseln und Mounten crypt.sh #!/bin/bash ###############################################################################$ # Autor: Frank Mankel # Verschlüsseltes Raid1 einbinden! # # Hardware: # ROCKPro64v2.1 # PCIe SATA Karte # 2St. 2,5 Zoll HDD Platten a 2TB # # Software: # bionic-minimal 0.7.9 # Kontakt: frank.mankel@gmail.com # ###############################################################################$ #Passwort abfragen echo "Passwort eingeben!" read -s password echo "Bitte warten......" #Passwörter abfragen echo -n $password | cryptsetup open /dev/sdX1 raid_pool0 -d - echo -n $password | cryptsetup open /dev/sdX1 raid_pool1 -d - #Raid1 mounten mount /dev/md0 /mnt/raid echo "Laufwerke erfolgreich gemountet!"

    Bis jetzt sieht das Raid ok aus, ich werde das die nächsten Tage mal ein wenig im Auge behalten.

    [ 82.430293] device-mapper: uevent: version 1.0.3 [ 82.430430] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com [ 108.196397] md/raid1:md0: not clean -- starting background reconstruction [ 108.196401] md/raid1:md0: active with 2 out of 2 mirrors [ 108.240395] md0: detected capacity change from 0 to 2000260497408 [ 110.076860] md: resync of RAID array md0 [ 110.385099] EXT4-fs (md0): recovery complete [ 110.431715] EXT4-fs (md0): mounted filesystem with ordered data mode. Opts: (null) [57744.301662] md: md0: resync done.
  • Installation von Grav & NGinx & PHP7.2

    Angeheftet Verschoben Grav
    2
    0 Stimmen
    2 Beiträge
    1k Aufrufe
    FrankMF

    Nachdem ich den ROCKPro64 jetzt auf den Mainline umgestellt habe, lief meine Testinstallation von Grav nicht mehr.

    Hilfreiche Sache um das Problem zu lösen -> https://gist.github.com/GhazanfarMir/03bd1f1f770a3834d47274586d46ea62

    Ich bekam immer 502 Bad Gateway, Grund war ein nicht korrekt gestarteter php-pfm Service.

    rock64@rockpro64v2_0:/usr/local/bin$ sudo service php7.2-fpm start rock64@rockpro64v2_0:/usr/local/bin$ sudo service php7.2-fpm status ● php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2018-08-16 20:15:20 CEST; 21s ago Docs: man:php-fpm7.2(8) Main PID: 3206 (php-fpm7.2) Status: "Processes active: 0, idle: 2, Requests: 3, slow: 0, Traffic: 0.2req/sec" Tasks: 3 (limit: 4622) CGroup: /system.slice/php7.2-fpm.service ├─3206 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf) ├─3207 php-fpm: pool www └─3208 php-fpm: pool www Aug 16 20:15:19 rockpro64v2_0 systemd[1]: Starting The PHP 7.2 FastCGI Process Manager... Aug 16 20:15:20 rockpro64v2_0 systemd[1]: Started The PHP 7.2 FastCGI Process Manager.