Skip to content

Passwordless SSH and sudo

ngadmini edited this page Jan 7, 2024 · 3 revisions

Pointers

  • add yourself to the sudoers list so that you don't have to enter your password over and over again:
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
  • your linux desktop and BIND9-server, both must configure to use passwordless for ssh and scp connections
    ~$ grep -n "alias\s\(_ssh\|_snc\)" grab_library
    12:alias _snc="rsync -rtxX -e 'ssh -q -T -c aes128-ctr -o Compression=no -x'"
    15:alias _ssh="ssh -q -T -c aes128-ctr -o Compression=no -x"

Create SSH Key

    Execute ssh-keygen
    Hit enter at every questions
    It's create two files, id_rsa and id_rsa.pub in dir ~/.ssh/
    Copy id_rsa.pub to your bind9-server

    ~# ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (~/.ssh/id_rsa): 
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in ~/.ssh/id_rsa.
    Your public key has been saved in ~/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:EscxSQnAVVfnRfkbB1/QGk+/+X7mG5nUoGwJrzv8yqQ ngadimin@q4os
    The keys randomart image is:
    +---[RSA 2048]----+
    |   ..oo+=o... o++|
    |    .  .o+   ooo+|
    |      . o .   oB+|
    |       o   + o.oB|
    |      . S   *  .B|
    |       .   o  .+o|
    |         .o    +.|
    |         +o.    =|
    |        E ++.  ==|
    +----[SHA256]-----+

Export SSH Key

    ~$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@your.bind9-server.example