kopia lustrzana https://github.com/jedie/PyInventory
add root server helper shell scripts
rodzic
edf7ea2919
commit
1fd6b46996
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
(
|
||||
set -x
|
||||
sudo apt update
|
||||
{ echo "---------------------------------------------------"; } 2>/dev/null
|
||||
sudo apt -y full-upgrade
|
||||
{ echo "---------------------------------------------------"; } 2>/dev/null
|
||||
sudo apt -y autoremove
|
||||
{ echo "---------------------------------------------------"; } 2>/dev/null
|
||||
# Delete old entries:
|
||||
sudo journalctl --vacuum-size=1G
|
||||
sudo journalctl --vacuum-time=1years
|
||||
)
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo "Please start with 'sudo' !"
|
||||
(
|
||||
set -x
|
||||
id
|
||||
exit 1
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
set -ex
|
||||
|
||||
export USERNAME=${1}
|
||||
|
||||
adduser --disabled-password --gecos "" --home=/home/${USERNAME} ${USERNAME}
|
||||
mkdir -p /home/${USERNAME}/.ssh
|
||||
cp /root/.ssh/authorized_keys /home/${USERNAME}/.ssh/
|
||||
chown -Rfc ${USERNAME}.${USERNAME} /home/${USERNAME}/
|
||||
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL">/etc/sudoers.d/${USERNAME}
|
Ładowanie…
Reference in New Issue