Linux User Creation: Difference between revisions
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
==Users » System== | ==Users » System== | ||
<syntaxhighlight lang="bash"> | |||
cat << EXE | sudo bash | |||
CHORKE_SYS_USERS='activemq artemis hadoop spark keycloak minikube minio wildfly' | |||
for SSH_USER in \${CHORKE_SYS_USERS};do | |||
if ! id -g \${SSH_USER} &>/dev/null;then addgroup --quiet --system \${SSH_USER};fi | |||
if ! id -u \${SSH_USER} &>/dev/null;then | |||
adduser --quiet --system --ingroup \${SSH_USER} --no-create-home --disabled-password \${SSH_USER} | |||
fi | |||
done | |||
cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | |||
cat /etc/group |awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | |||
EXE | |||
</syntaxhighlight> | |||
===Users » System » With Home === | ===Users » System » With Home === | ||
---- | ---- | ||
Line 21: | Line 36: | ||
ls -alh /home/*/.ssh/* && echo | ls -alh /home/*/.ssh/* && echo | ||
cat /etc/passwd|awk -F : '\$3 > 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | ||
cat /etc/group |awk -F : '\$3 > 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | cat /etc/group |awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | ||
EXE | EXE | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 46: | Line 61: | ||
ls -alh /home/*/.ssh/* && echo | ls -alh /home/*/.ssh/* && echo | ||
cat /etc/passwd|awk -F : '\$3 > 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | cat /etc/passwd|awk -F : '\$3 >= 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | ||
cat /etc/group |awk -F : '\$3 > 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | cat /etc/group |awk -F : '\$3 >= 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | ||
EXE | EXE | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 08:27, 12 December 2024
Users » System
cat << EXE | sudo bash
CHORKE_SYS_USERS='activemq artemis hadoop spark keycloak minikube minio wildfly'
for SSH_USER in \${CHORKE_SYS_USERS};do
if ! id -g \${SSH_USER} &>/dev/null;then addgroup --quiet --system \${SSH_USER};fi
if ! id -u \${SSH_USER} &>/dev/null;then
adduser --quiet --system --ingroup \${SSH_USER} --no-create-home --disabled-password \${SSH_USER}
fi
done
cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo
cat /etc/group |awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h
EXE
Users » System » With Home
cat << EXE | sudo bash
CHORKE_SYS_USERS='academia agronomy assembla aviation commando crafting'
for SSH_USER in \${CHORKE_SYS_USERS};do
if ! id -g \${SSH_USER} &>/dev/null;then addgroup --quiet --system \${SSH_USER};fi
if ! id -u \${SSH_USER} &>/dev/null;then
adduser --quiet --system --home /home/\${SSH_USER} --shell /bin/bash --disabled-password \${SSH_USER}
mkdir /home/\${SSH_USER}/.ssh && touch /home/\${SSH_USER}/.ssh/authorized_keys
touch /home/\${SSH_USER}/.ssh/config
chown -R \${SSH_USER}:\${SSH_USER} /home/\${SSH_USER}/.ssh
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER}
chmod 600 /home/\${SSH_USER}/.ssh/authorized_keys
chmod 600 /home/\${SSH_USER}/.ssh/config
chmod 700 /home/\${SSH_USER}/.ssh
fi
done
ls -alh /home/*/.ssh/* && echo
cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo
cat /etc/group |awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h
EXE
Users » General » With Home
cat << EXE | sudo bash
CHORKE_EXT_USER='argo.cd drone.ci tool.tech raiyan.shahed shahed.hossain'
for SSH_USER in \${CHORKE_EXT_USER};do
if ! id -u \${SSH_USER} &>/dev/null;then
useradd --create-home --home-dir /home/\${SSH_USER} --shell /bin/bash \${SSH_USER}
mkdir /home/\${SSH_USER}/.ssh && touch /home/\${SSH_USER}/.ssh/authorized_keys
touch /home/\${SSH_USER}/.ssh/config
chown -R \${SSH_USER}:\${SSH_USER} /home/\${SSH_USER}/.ssh
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER}
chmod 600 /home/\${SSH_USER}/.ssh/authorized_keys
chmod 600 /home/\${SSH_USER}/.ssh/config
chmod 700 /home/\${SSH_USER}/.ssh
fi
done
ls -alh /home/*/.ssh/* && echo
cat /etc/passwd|awk -F : '\$3 >= 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo
cat /etc/group |awk -F : '\$3 >= 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h
EXE
Playground
apt list --installed|grep linux-image
|
systemd-analyze blame
|
dpkg -l | grep "gnome-shell-extension" |
| ||
systemctl list-dependencies graphical.target
cat /proc/acpi/wakeup
|
sudo apt list --installed|grep desktop-icons
sudo dpkg-query -l|grep desktop-icons
|
sudo apt install gnome-shell-extension-manager
apt info gnome-shell-extension-manager -a
|
| ||
cat <<-'EXE'|sudo bash
umount /var/snap/firefox/common/host-hunspell
snap remove firefox
EXE
|
cat <<-'EXE'|sudo bash
snap disable remmina
snap remove --purge remmina
EXE
|
systemctl list-dependencies --type=service --state=running systemctl list-dependencies --type=service --state=active systemctl list-dependencies docker.service systemctl list-dependencies --all |
| ||
cat /etc/passwd
cat /etc/group
|
cat /etc/passwd|\
awk -F : '$3 >= 1000 {printf("%-6s » %s\n", $3, $1)}'|sort -h
|
useradd -m -d /home/chorke -s /bin/bash chorke useradd -m -d /home/chorke -s /bin/bash chorke |
References
| ||