pythoruler:
PocketBook 7.8", Android 5.5": MD to HTML with MS VSC +
Markdown All in One by Yu Zhang
Google Chrome -> print to pdf -> A4, Portrait,
Margins: top, bottom 1" left, right 0", Scale 140%
[ ] Headers and Footers
[ ] Background Graphics
234567891123456789212345678931234567894123456789512345678961
--------|---------|---------|---------|---------|---------|-
Manually:
# addgroup mix
Adding group `mix' (GID 1001) ...
Done.
# adduser --ingroup mix lunarian
Adding user `lunarian' ...
...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for lunarian
Enter the new value, or press ENTER for the default
Full Name []: astronomer
Room Number []: earth
Work Phone []: 123
Home Phone []: 000
Other []: funky
Is the information correct? [Y/n] y
# echo "=== last record in /etc/group ==="
=== last record in /etc/group ===
# cat /etc/group | tail -n 1
mix:x:1001:
# echo "=== last record in /etc/group ==="
=== last record in /etc/group ===
# cat /etc/group | tail -n 1
mix:x:1001:
# echo "=== last record in /etc/passwd ==="
=== last record in /etc/passwd ===
# cat /etc/passwd | tail -n 1
lunarian:x:1001:1001:astronomer,earth,123,000,\
funky:/home/lunarian:/bin/bash
# echo "=== list of /home directory ==="
=== list of /home directory ===
# ls -l /home
total 8
drwxr-xr-x 17 it it 4096 Nov 3 06:56 it
drwxr-xr-x 2 lunarian mix 4096 Nov 4 06:41 lunarian
Now removing
# deluser lunarian
Removing user `lunarian' ...
Warning: group `mix' has no more members.
Done.
# delgroup mix
Removing group `mix' ...
Done.
# rm -rf /home/lunarian/
# echo "=== last record in /etc/group ==="
=== last record in /etc/group ===
# cat /etc/group | tail -n 1
geoclue:x:123:
# echo "=== last record in /etc/passwd ==="
=== last record in /etc/passwd ===
# cat /etc/passwd | tail -n 1
geoclue:x:114:123::/var/lib/geoclue:/usr/sbin/nologin
# echo "=== list of /home directory ==="
=== list of /home directory ===
# ls -l /home
total 4
drwxr-xr-x 17 it it 4096 Nov 3 06:56 it
As we intend to create many users with script, let's build the list of users with ed.
# ed band
band: No such file or directory
a
human
alien
martian
selenite
ghost
cyborg
zombie
.
wq
49
#
We need to learn how to loop over the list of our users (file named "band"):
#!/bin/bash
for i in $(cat band)
do
echo $i 2>&1 | cat > /dev/null
done
Finally:
#!/bin/bash
addgroup band
for i in $(cat band)
do
adduser --ingroup band $i << EOI 2>&1 | cat > /dev/null
$i
$i
$i
Earth
funky
y
EOI
done
echo "=== last record in /etc/group ==="
cat /etc/group | tail -n 1
echo "=== last records in /etc/passwd ==="
cat /etc/passwd | tail -n $(cat band | wc -l)
echo "=== list of /home directory ==="
ls -l /home
#!/bin/bash
for i in $(cat band)
do
deluser $i
rm -rf /home/$i
done
delgroup band
echo "=== last record in /etc/group ==="
cat /etc/group | tail -n 1
echo "=== last record in /etc/passwd ==="
cat /etc/passwd | tail -n 1
echo "=== list of /home directory ==="
ls -l /home