Linux User Creation: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Users » System== ===Users » System » With Home === ---- <syntaxhighlight lang="bash"> 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 \${SSH_USER} mkdir /home/\${SSH_USER}/.ssh...") |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== | ==System » User== | ||
=== | ===System » User » Homeless=== | ||
---- | ---- | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cat << EXE | sudo 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} --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 | |||
</syntaxhighlight> | |||
===System » User » Resident=== | |||
---- | |||
<syntaxhighlight lang="bash"> | |||
cat << EXE | sudo bash | |||
mkdir -p /home/system/ | |||
CHORKE_SYS_USERS='academia agronomy assembla aviation commando crafting' | CHORKE_SYS_USERS='academia agronomy assembla aviation commando crafting' | ||
for SSH_USER in \${CHORKE_SYS_USERS};do | for SSH_USER in \${CHORKE_SYS_USERS};do | ||
if ! id -g \${SSH_USER} &>/dev/null;then addgroup --quiet --system \${SSH_USER};fi | if ! id -g \${SSH_USER} &>/dev/null;then addgroup --quiet --system \${SSH_USER};fi | ||
if ! id -u \${SSH_USER} &>/dev/null;then | if ! id -u \${SSH_USER} &>/dev/null;then | ||
adduser --quiet --system -- | 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 | |||
chmod 600 /home/\${SSH_USER}/.ssh/authorized_keys | touch /home/system/\${SSH_USER}/.ssh/authorized_keys | ||
chmod 600 /home/\${SSH_USER}/.ssh/config | |||
chmod 700 /home/\${SSH_USER}/.ssh | 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 | fi | ||
done | done | ||
ls -alh /home/*/.ssh/* && | echo && ls -alh /home/system/*/.ssh/* | ||
cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < | echo && cat /etc/passwd|awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h | ||
cat /etc/group |awk -F : '\$3 >= 120 && \$3 < | echo && cat /etc/group |awk -F : '\$3 >= 120 && \$3 < 900 {printf("%-6s » %s\n", \$3, \$1)}'|sort -h && echo | ||
EXE | EXE | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | ==Common » User== | ||
===Common » User » Resident=== | |||
---- | ---- | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cat << EXE | sudo bash | cat << EXE | sudo bash | ||
CHORKE_EXT_USER='argo.cd drone.ci tool.tech shahed.hossain | mkdir -p /home/common/ | ||
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/\${SSH_USER} --shell /bin/bash \${SSH_USER} | useradd --create-home --home-dir /home/common/\${SSH_USER} --shell /bin/bash \${SSH_USER} | ||
mkdir /home/\${SSH_USER}/.ssh | chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER} | ||
touch /home/\${SSH_USER}/.ssh/ | |||
mkdir /home/common/\${SSH_USER}/.ssh | |||
touch /home/common/\${SSH_USER}/.ssh/config | |||
touch /home/common/\${SSH_USER}/.ssh/authorized_keys | |||
chown -R \${SSH_USER}:\${SSH_USER} /home/\${SSH_USER}/ | chown -R \${SSH_USER}:\${SSH_USER} /home/common/\${SSH_USER}/ | ||
chmod 600 /home/common/\${SSH_USER}/.ssh/authorized_keys | |||
chmod 600 /home/\${SSH_USER}/.ssh/authorized_keys | chmod 600 /home/common/\${SSH_USER}/.ssh/config | ||
chmod 600 /home/\${SSH_USER}/.ssh/config | chmod 700 /home/common/\${SSH_USER}/.ssh | ||
chmod 700 /home/\${SSH_USER}/.ssh | |||
fi | fi | ||
done | done | ||
ls -alh /home/*/.ssh/* && | echo && ls -alh /home/common/*/.ssh/* | ||
cat /etc/passwd|awk -F : '\$3 >= 1000 {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 | ||
cat /etc/group |awk -F : '\$3 >= 1000 {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 | EXE | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 132: | Line 156: | ||
useradd -m -d /home/chorke -s /bin/bash chorke | useradd -m -d /home/chorke -s /bin/bash chorke | ||
useradd -m -d /home/chorke -s /bin/bash chorke | useradd -m -d /home/chorke -s /bin/bash chorke | ||
|- | |||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" colspan="3" | | |||
<syntaxhighlight lang="bash"> | |||
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 | |||
</syntaxhighlight> | |||
|} | |} | ||
Line 141: | Line 175: | ||
* [https://unix.stackexchange.com/questions/210228/ Linux » Add a user without password] | * [https://unix.stackexchange.com/questions/210228/ Linux » Add a user without password] | ||
* [https://unix.stackexchange.com/questions/533663/ Linux » Get users with UID >= 1000] | * [https://unix.stackexchange.com/questions/533663/ Linux » Get users with UID >= 1000] | ||
* [https://manpages.debian.org/bookworm/adduser/adduser.conf.5.en.html Linux » Add User] | |||
| valign="top" | | |||
| valign="top" | | |||
|- | |||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
* [[Ubuntu/Raspberry Pi]] | |||
* [[Ubuntu Upgrade]] | |||
* [[ActiveMQ]] | |||
* [[Minikube]] | |||
* [[Keycloak]] | |||
* [[Hadoop]] | |||
* [[Jenkins]] | |||
* [[WildFly]] | |||
* [[Spark]] | |||
* [[MinIO]] | |||
| valign="top" | | | valign="top" | |
Latest revision as of 17:24, 12 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
Common » User
Common » User » Resident
cat << EXE | sudo bash
mkdir -p /home/common/
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/common/\${SSH_USER} --shell /bin/bash \${SSH_USER}
chage -m 99999 -M 99999 -E -1 -I -1 \${SSH_USER}
mkdir /home/common/\${SSH_USER}/.ssh
touch /home/common/\${SSH_USER}/.ssh/config
touch /home/common/\${SSH_USER}/.ssh/authorized_keys
chown -R \${SSH_USER}:\${SSH_USER} /home/common/\${SSH_USER}/
chmod 600 /home/common/\${SSH_USER}/.ssh/authorized_keys
chmod 600 /home/common/\${SSH_USER}/.ssh/config
chmod 700 /home/common/\${SSH_USER}/.ssh
fi
done
echo && ls -alh /home/common/*/.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
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
| ||
| ||