added user portion of script

This commit is contained in:
2026-05-02 14:39:07 +00:00
parent c48c1492af
commit aa7b5428c7
+21
View File
@@ -18,6 +18,27 @@ apt-get dist-upgrade -y
# download and install packages # download and install packages
apt-get install -y hstr htop ncdu proxmox-ve postfix open-iscsi sudo pwgen curl wget zip unzip git man-db cifs-utils nfs-common ntfs-3g parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion apt-get install -y hstr htop ncdu proxmox-ve postfix open-iscsi sudo pwgen curl wget zip unzip git man-db cifs-utils nfs-common ntfs-3g parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
# add akanealw user if not existing
isInFile=$(cat /etc/passwd | grep -c "akanealw")
if [ $isInFile -eq 0 ]
then
echo "Set password for akanealw"
useradd -m -p '$y$j9T$NB7zOwLzhMgtxiCGjzwvf.$YGAIpv6m/DIlgNT5IU5H.K.QSNMCG5/TKY9sYlfGsGB' -s /bin/bash -d /home/akanealw akanealw
mkdir /home/akanealw/.ssh
chown akanealw:akanealw /home/akanealw/.ssh
chmod 700 /home/akanealw/.ssh
cp /root/.ssh/authorized_keys /home/akanealw/.ssh > /dev/null 2>&1
chown akanealw:akanealw /home/akanealw/.ssh/authorized_keys > /dev/null 2>&1
chmod 600 /home/akanealw/.ssh/authorized_keys > /dev/null 2>&1
fi
# create akanealw file in /etc/sudoers.d
if [[ ! -f /etc/sudoers.d/akanealw ]]
then
echo "akanealw ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/akanealw
fi
usermod -a -G sudo akanealw
# update templates # update templates
pveam update pveam update