Compare commits
No commits in common. "9e8d93d4ea4527764a9501315001c24d5f36c344" and "7b1dcdf13b6cfb4d54fda659c6556e5838dd1ce9" have entirely different histories.
9e8d93d4ea
...
7b1dcdf13b
12
makeitso
12
makeitso
|
@ -5,12 +5,9 @@ if [ $# -ne 1 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /home/authorizedkeysuser ]; then
|
#sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser ||
|
||||||
#sudo adduser --disabled-login --gecos 'User for AuthorizedKeysCommand' authorizedkeysuser ||
|
sudo useradd -c 'User for AuthorizedKeysCommand' -d /home/authorizedkeysuser -m -s/usr/sbin/nologin authorizedkeysuser
|
||||||
sudo useradd -c 'User for AuthorizedKeysCommand' -d /home/authorizedkeysuser -m -s/usr/sbin/nologin authorizedkeysuser
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep -q AuthorizedKeysCommand /etc/ssh/sshd_config || \
|
|
||||||
sudo sh -c "echo 'Match User $1
|
sudo sh -c "echo 'Match User $1
|
||||||
AuthorizedKeysCommand /etc/ssh/get_authorized_keys
|
AuthorizedKeysCommand /etc/ssh/get_authorized_keys
|
||||||
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"
|
AuthorizedKeysCommandUser authorizedkeysuser' >> /etc/ssh/sshd_config"
|
||||||
|
@ -19,4 +16,9 @@ sudo cp get_authorized_keys /etc/ssh
|
||||||
|
|
||||||
sudo chmod 755 /etc/ssh/get_authorized_keys
|
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 -H -u authorizedkeysuser sh -c 'command -v aws > /dev/null 2>&1 || pip install --user awscli'
|
||||||
sudo systemctl restart sshd
|
sudo systemctl restart sshd
|
||||||
|
|
Loading…
Reference in New Issue
Block a user