diff --git a/.gitignore b/.gitignore index 8a88443..55ea426 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ sheet01/a2/Hash.java *.class passwd +sheet04/AuthWithTOTP.java +sheet04/key-exchange.pcap \ No newline at end of file diff --git a/sheet05/a1/create_user.sh b/sheet05/a1/create_user.sh index fe296d6..aa3bd17 100644 --- a/sheet05/a1/create_user.sh +++ b/sheet05/a1/create_user.sh @@ -1,3 +1,3 @@ #!/bin/bash # $1 = username, $2 = comma-separated groups -useradd -G "$2" -m -s /bin/bash "$1" || usermod -aG "$2" "$1" \ No newline at end of file +useradd -G "$2" "$1" || usermod -aG "$2" "$1" \ No newline at end of file diff --git a/sheet05/a2/archive.sh b/sheet05/a2/archive.sh new file mode 100644 index 0000000..82a60f6 --- /dev/null +++ b/sheet05/a2/archive.sh @@ -0,0 +1,3 @@ +#!/bin/bash +TARGET_DIR=$1 +chmod -R a-w "$TARGET_DIR" \ No newline at end of file diff --git a/sheet05/a2/create_user.sh b/sheet05/a2/create_user.sh new file mode 100644 index 0000000..b0baee8 --- /dev/null +++ b/sheet05/a2/create_user.sh @@ -0,0 +1,4 @@ +#!/bin/bash +USERNAME=$1 +GROUPS=$2 +useradd -G "$GROUPS" "$USERNAME" || usermod -aG "$GROUPS" "$USERNAME" \ No newline at end of file diff --git a/sheet05/a2/explanation.txt b/sheet05/a2/explanation.txt new file mode 100644 index 0000000..f2b6167 --- /dev/null +++ b/sheet05/a2/explanation.txt @@ -0,0 +1,3 @@ +The supervisor's read access would fail with UNIX permissions, since they are limited to one owner, one group, and "others". +Access Control Lists (ACLs) resolve this problem by allowing permissions beyond the standard three. +Using `setfacl`, we can append specific read and execute rights (r-x) for individual users (the supervisors) directly to the files and directories. \ No newline at end of file diff --git a/sheet05/a2/supervisor.sh b/sheet05/a2/supervisor.sh new file mode 100644 index 0000000..c231909 --- /dev/null +++ b/sheet05/a2/supervisor.sh @@ -0,0 +1,6 @@ +#!/bin/bash +SUPERVISOR=$1 +# Grant read and execute permissions to the supervisor user recursively +setfacl -R -m u:"$SUPERVISOR":r-x . +# Set the default ACL +setfacl -R -d -m u:"$SUPERVISOR":r-x . \ No newline at end of file