replace-su-with-sudo.sh 874 Bytes
Newer Older
1
2
#!/bin/bash

3
4
5
6
7
8
9
10
11
# Replace su by a message to use sudo.
#
# In Tails, the administration password doesn't work with 'su'. New
# users in particular may be puzzled by the authentication failures
# while trying to 'su' using administration password.
#
# This script introduces 'su' function for non-root users which asks
# them to use 'sudo' instead of 'su'.
#
12
13
# https://redmine.tails.boum.org/code/issues/15583

14
15
16
17
18
19
20
21
22
# Get LANG
. /etc/default/locale
export LANG

# Initialize gettext support
. gettext.sh
TEXTDOMAIN="tails"
export TEXTDOMAIN

23
24
25
# Since we don't want to add 'su' function for root user, we will stop
# execution of this script if $USER is root.
[ "$USER" == root ] && return
26
27

su (){
28
29
    if tails_is_password_set.py; then
        echo "`gettext \"su is disabled. Please use sudo instead.\"`"
30
31
32
33
    else
        cat /usr/share/tails-greeter/no-password-lecture.txt
    fi
}