121 lines
4.2 KiB
Bash
121 lines
4.2 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Aufgabe 8a
|
||
|
yum install --yes acl
|
||
|
|
||
|
# Aufgabe 8b
|
||
|
mkdir --parents /tmp/acl-test/share
|
||
|
|
||
|
# Aufgabe 8c
|
||
|
sudo chown --recursive root:root /tmp/acl-test
|
||
|
sudo chmod 770 /tmp/acl-test
|
||
|
|
||
|
# Aufgabe 8d
|
||
|
sudo useradd --badnames "functional user acl" fuacl
|
||
|
sudo setfacl --default --recursive -m "u:fuacl:rwx" /tmp/acl-test
|
||
|
|
||
|
# Aufgabe 8e
|
||
|
sudo setfacl --remove-default /tmp/acl-test/share
|
||
|
|
||
|
# Aufgabe 8f
|
||
|
sudo chmod 2770 /tmp/acl-test # gruppe "root" vererben
|
||
|
sudo setfacl --default --recursive -m "g:root:rwx" /tmp/acl-test # berechtigung per ACL für gruppe root setzen
|
||
|
|
||
|
# Aufgabe 8g
|
||
|
sudo setfacl --remove-default --recursive /tmp/acl-test
|
||
|
|
||
|
# Aufgabe 8h
|
||
|
sudo setfacl --remove-all /tmp/acl-test
|
||
|
|
||
|
# Aufgabe 9a
|
||
|
|
||
|
sudo groupadd --gid 2000 dev
|
||
|
sudo groupadd --gid 2001 sysadm
|
||
|
sudo groupadd --gid 2002 hr
|
||
|
sudo groupadd --gid 2003 fi
|
||
|
sudo groupadd --gid 2004 qa
|
||
|
sudo groupadd --gid 2005 sec
|
||
|
sudo groupadd --gid 2006 mang
|
||
|
|
||
|
# Aufgabe 9b
|
||
|
|
||
|
sudo useradd --uid 2000 --gid users --comment "Hugo McKinnock" hugo
|
||
|
sudo useradd --uid 2001 --gid users --comment "Hans Rakinzsky" hans
|
||
|
sudo useradd --uid 2002 --gid users --comment "Marie Haseloff" marie
|
||
|
sudo useradd --uid 2003 --gid users --comment "Sophie Becker" sophie
|
||
|
sudo useradd --uid 2004 --gid users --comment "Axel Tuller" axel
|
||
|
sudo useradd --uid 2005 --gid users --comment "Tobias Moretti" tobias
|
||
|
sudo useradd --uid 2006 --gid users --comment "Lias Meerkamp" lisa
|
||
|
sudo useradd --uid 2007 --gid users --comment "Menfred Krupp" manfred
|
||
|
|
||
|
# Aufgabe 9c
|
||
|
|
||
|
sudo usermod --append --groups dev hugo
|
||
|
sudo usermod --append --groups dev,sysadm hans
|
||
|
sudo usermod --append --groups hr,fi marie
|
||
|
sudo usermod --append --groups hr sophie
|
||
|
sudo usermod --append --groups sysadm axel
|
||
|
sudo usermod --append --groups dev,qa tobias
|
||
|
sudo usermod --append --groups sec lisa
|
||
|
sudo usermod --append --groups mang manfred
|
||
|
|
||
|
# Aufgabe 9d
|
||
|
|
||
|
sudo mkdir --parent /srv/documents/development/public
|
||
|
sudo mkdir --parent /srv/documents/system_administration/{public,private}
|
||
|
sudo mkdir --parent /srv/documents/finance/{public,private}
|
||
|
sudo mkdir --parent /srv/documents/human_resources/{public,private}
|
||
|
sudo mkdir --parent /srv/documents/quality_assurance/public
|
||
|
sudo mkdir --parent /srv/documents/secrecary/private
|
||
|
sudo mkdir --parent /srv/documents/management/private
|
||
|
|
||
|
# Aufgabe 9e
|
||
|
|
||
|
sudo chown root:dev --recursive /srv/documents/development
|
||
|
sudo chown root:sysadm --recursive /srv/documents/system_administration
|
||
|
sudo chown root:fi --recursive /srv/documents/finance
|
||
|
sudo chown root:hr --recursive /srv/documents/human_resources
|
||
|
sudo chown root:qa --recursive /srv/documents/quality_assurance
|
||
|
sudo chown root:sec --recursive /srv/documents/secrecary
|
||
|
sudo chown root:mang --recursive /srv/documents/management
|
||
|
|
||
|
sudo chmod 3775 --recursive /srv/documents/*
|
||
|
sudo chmod 3770 --recursive /srv/documents/*/private
|
||
|
|
||
|
sudo setfacl --default -m "g:dev:rwx" --recursive /srv/documents/development
|
||
|
sudo setfacl --default -m "g:sysadm:rwx" --recursive /srv/documents/system_administration
|
||
|
sudo setfacl --default -m "g:fi:rwx" --recursive /srv/documents/finance
|
||
|
sudo setfacl --default -m "g:hr:rwx" --recursive /srv/documents/human_resources
|
||
|
sudo setfacl --default -m "g:qa:rwx" --recursive /srv/documents/quality_assurance
|
||
|
sudo setfacl --default -m "g:sec:rwx" --recursive /srv/documents/secrecary
|
||
|
sudo setfacl --default -m "g:mang:rwx" --recursive /srv/documents/management
|
||
|
|
||
|
# Aufgabe 9f
|
||
|
|
||
|
# als sophie (niemand außer hr mitglieder haben zugang)
|
||
|
mkdir --parent /srv/documents/human_resources/private/applications
|
||
|
touch /srv/documents/human_resources/private/applications/Gerd_Reimann.pdf
|
||
|
|
||
|
# alle haben lese Zugang Beispielsweise für Vorlagen ect.
|
||
|
mkdir --parents /srv/documents/human_resources/public/templates
|
||
|
touch /srv/documents/human_resources/public/templates/travel_expense_report.docx
|
||
|
|
||
|
# CLEANUP
|
||
|
|
||
|
sudo rm --recursive --force /srv/documents
|
||
|
sudo userdel --force --remove hugo
|
||
|
sudo userdel --force --remove hans
|
||
|
sudo userdel --force --remove marie
|
||
|
sudo userdel --force --remove sophie
|
||
|
sudo userdel --force --remove axel
|
||
|
sudo userdel --force --remove tobias
|
||
|
sudo userdel --force --remove lisa
|
||
|
sudo userdel --force --remove manfred
|
||
|
|
||
|
sudo groupdel dev
|
||
|
sudo groupdel sysadm
|
||
|
sudo groupdel hr
|
||
|
sudo groupdel fi
|
||
|
sudo groupdel qa
|
||
|
sudo groupdel sec
|
||
|
sudo groupdel mang
|