Add SSH Key Auth on User for Debian/Ubuntu and Enable Sudo Without Password

Exported on 23-Aug-2021 16:30:00

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Copy pubkey

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
Deploy archive Linux authorized_keys files.zip to remote path files/
  1. Locate Files archive "Linux authorized_keys files.zip", This can be downloaded from Attune
  2. Copy the Files archive to the server
  3. Extract the root of the Files archive to files/, relative to the home directory
  4. Check that the files are in the correct location

2 - add id_rsa.pub to authorized_keys

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
mkdir -p ~/.ssh
cat >> ~/.ssh/authorized_keys < ~/files/id_rsa.pub

sudo cp ~/files/attune_user /tmp/attune_user
sudo cp ~/files/sudoers /tmp/sudoers

sudo su -
cp /tmp/attune_user /etc/sudoers.d/attune_user
rm -rf /etc/sudoers && cp /tmp/sudoers /etc/sudoers