Linux User Creation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 46: | Line 46: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==Chorke » User== | ||
=== | ===Chorke » User » Resident=== | ||
---- | ---- | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cat << EXE | sudo bash | cat << EXE | sudo bash | ||
mkdir -p /home/ | mkdir -p /home/chorke/ | ||
CHORKE_EXT_USER='argo.cd drone.ci tool.tech raiyan.shahed shahed.hossain' | CHORKE_EXT_USER='argo.cd drone.ci tool.tech raiyan.shahed shahed.hossain' | ||
for SSH_USER in \${CHORKE_EXT_USER};do | for SSH_USER in \${CHORKE_EXT_USER};do | ||
if ! id -u \${SSH_USER} &>/dev/null;then | if ! id -u \${SSH_USER} &>/dev/null;then | ||
useradd --create-home --home-dir /home/ | useradd --create-home --home-dir /home/chorke/\${SSH_USER} --shell /bin/bash \${SSH_USER} | ||
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER} | chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER} | ||
mkdir /home/ | mkdir /home/chorke/\${SSH_USER}/.ssh | ||
touch /home/ | touch /home/chorke/\${SSH_USER}/.ssh/config | ||
touch /home/ | touch /home/chorke/\${SSH_USER}/.ssh/authorized_keys | ||
chown -R \${SSH_USER}:\${SSH_USER} /home/ | chown -R \${SSH_USER}:\${SSH_USER} /home/chorke/\${SSH_USER}/ | ||
chmod 600 /home/ | chmod 600 /home/chorke/\${SSH_USER}/.ssh/authorized_keys | ||
chmod 600 /home/ | chmod 600 /home/chorke/\${SSH_USER}/.ssh/config | ||
chmod 700 /home/ | chmod 700 /home/chorke/\${SSH_USER}/.ssh | ||
fi | fi | ||
done | done | ||
echo && ls -alh /home/ | echo && ls -alh /home/chorke/*/.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 && echo | echo && cat /etc/group |awk -F : '\$3 >= 1000 && \$3 < 65500 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | ||
Line 89: | Line 89: | ||
lxc list status=running name=cloudflare --format=yaml |yq -r '.[].state.network.[].addresses' | lxc list status=running name=cloudflare --format=yaml |yq -r '.[].state.network.[].addresses' | ||
lxc info cloudflare|yq '.Resources.["Network usage"][]["IP addresses"].inet' | lxc info cloudflare|yq '.Resources.["Network usage"][]["IP addresses"].inet' | ||
</syntaxhighlight> | |||
|- | |||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
<syntaxhighlight lang="bash"> | |||
ls -lah /usr/local/etc/cloudflared/ | |||
ls -lah /etc/cloudflared/ | |||
ls -lah ~/.cloudflared/ | |||
</syntaxhighlight> | |||
| colspan="2" | | |||
<syntaxhighlight lang="bash"> | |||
lxc snapshot cloudflare argo:24.04 | |||
lxc publish cloudflare/argo:24.04 --alias cloudflare/argo:24.04 | |||
lxc restore cloudflare argo:24.04 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 03:11, 26 December 2024
System » User
System » User » Homeless
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} --home /nonexistent --shell /usr/sbin/nologin --disabled-password \${SSH_USER}
fi
done
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 && echo
EXE
System » User » Resident
cat << EXE | sudo bash
mkdir -p /home/system/
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 --ingroup \${SSH_USER} --home /home/system/\${SSH_USER} --shell /bin/bash --disabled-password \${SSH_USER}
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER}
mkdir /home/system/\${SSH_USER}/.ssh
touch /home/system/\${SSH_USER}/.ssh/config
touch /home/system/\${SSH_USER}/.ssh/authorized_keys
chown -R \${SSH_USER}:\${SSH_USER} /home/system/\${SSH_USER}/
chmod 600 /home/system/\${SSH_USER}/.ssh/authorized_keys
chmod 600 /home/system/\${SSH_USER}/.ssh/config
chmod 700 /home/system/\${SSH_USER}/.ssh
fi
done
echo && ls -alh /home/system/*/.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 && echo
EXE
Chorke » User
Chorke » User » Resident
cat << EXE | sudo bash
mkdir -p /home/chorke/
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/chorke/\${SSH_USER} --shell /bin/bash \${SSH_USER}
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER}
mkdir /home/chorke/\${SSH_USER}/.ssh
touch /home/chorke/\${SSH_USER}/.ssh/config
touch /home/chorke/\${SSH_USER}/.ssh/authorized_keys
chown -R \${SSH_USER}:\${SSH_USER} /home/chorke/\${SSH_USER}/
chmod 600 /home/chorke/\${SSH_USER}/.ssh/authorized_keys
chmod 600 /home/chorke/\${SSH_USER}/.ssh/config
chmod 700 /home/chorke/\${SSH_USER}/.ssh
fi
done
echo && ls -alh /home/chorke/*/.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 && echo
EXE
Playground
lxc image list images:ubuntu/noble/desktop
lxc launch --vm images:ffa5fc9dfb84 cloudflare
lxc launch --vm images:ubuntu/noble/desktop cloudflare
|
lxc list status=running name=cloudflare --format=json |jq -r '.[].state.network.[].addresses'
lxc list status=running name=cloudflare --format=yaml |yq -r '.[].state.network.[].addresses'
lxc info cloudflare|yq '.Resources.["Network usage"][]["IP addresses"].inet'
| |
| ||
ls -lah /usr/local/etc/cloudflared/
ls -lah /etc/cloudflared/
ls -lah ~/.cloudflared/
|
lxc snapshot cloudflare argo:24.04
lxc publish cloudflare/argo:24.04 --alias cloudflare/argo:24.04
lxc restore cloudflare argo:24.04
| |
| ||
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 |
| ||
adduser --quiet --system --ingroup chorke --no-create-home --shell /usr/sbin/nologin --disabled-password chorke
adduser --quiet --system --ingroup chorke --home /nonexistent --shell /usr/sbin/nologin --disabled-password chorke
|
References
| ||
| ||