Commit baec650a authored by m3hm00d's avatar m3hm00d
Browse files

Update bash.bashrc at runtime to disable su. (refs: #15583)

1. '51-update-bash.bashrc' appends bash.bashrc to source additional
settings/aliases from scripts in '/etc/bash.bashrc.d/'.

2. 'replace-su-with-sudo.sh' adds a function named 'su' for users other
than root. This function disables the usage of 'su'.
parent 9bf14fda
#!/bin/sh
set -e
# Update /etc/bash.bashrc at runtime as defined in /etc/bash.bashrc.d/*
echo "Updating /etc/bash.bashrc"
OPTS_FILE='/etc/bash.bashrc'
OPTS_DIR='/etc/bash.bashrc.d/*'
cat <<EOF>> "${OPTS_FILE}"
for file in ${OPTS_DIR};
do
source "\$file"
done
EOF
#!/bin/bash
# Replace su by a message to use sudo
# https://redmine.tails.boum.org/code/issues/15583
[ $USER == root ] && return
su (){
tails_is_password_set.py
if [ $? -eq 0 ]; then
echo su is disabled. Please use sudo instead.
else
cat /usr/share/tails-greeter/no-password-lecture.txt
fi
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment