18 lines
710 B
Plaintext
18 lines
710 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser
|
||
|
|
||
|
sudo sh -c "echo 'AuthorizedKeysCommand /etc/ssh/get_authorized_keys
|
||
|
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"
|
||
|
|
||
|
sudo cp authorized_keys /etc/ssh
|
||
|
|
||
|
sudo chmod 755 /etc/ssh/get_authorized_keys
|
||
|
|
||
|
sudo -u authorizedkeysuser mkdir ~authorizedkeysuser/.aws
|
||
|
sudo -u authorizedkeysuser cp config ~authorizedkeysuser/.aws
|
||
|
sudo -u authorizedkeysuser cp .credentials ~authorizedkeysuser/.aws/credentials
|
||
|
sudo -u authorizedkeysuser chmod 600 ~authorizedkeysuser/.aws/*
|
||
|
sudo -u authorizedkeysuser sh -c 'command -v aws > /dev/null 2>&1 || pip install --user awscli'
|
||
|
sudo systemctl restart sshd
|