Sat, 18 Jul 2020 15:55:11 +0200
Version 0.23 some fixes for newer awk versions.
5 | 1 | #!/bin/bash |
2 | # | |
3 | ############################################################################# | |
20
1d18ebb9e279
Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
4 | # Copyright (C) 2005-2014 |
5 | 5 | # |
17
65656789da08
Removed uptime script, changed passwd test, minimized sensors output, bumped to version 0.18
Michiel Broek <mbroek@mbse.eu>
parents:
14
diff
changeset
|
6 | # Michiel Broek <mbse at mbse.eu> |
5 | 7 | # |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
5
diff
changeset
|
8 | # This file is part of SlackSecCheckScripts. |
5 | 9 | # |
10 | # This package is free software; you can redistribute it and/or modify it | |
11 | # under the terms of the GNU General Public License as published by the | |
12 | # Free Software Foundation; either version 2, or (at your option) any | |
13 | # later version. | |
14 | # | |
14
59e07bba67cc
Fixed spelling error, updated address
Michiel Broek <mbse@mbse.eu>
parents:
5
diff
changeset
|
15 | # SlackSecCheckScripts is distributed in the hope that it will be useful, but |
5 | 16 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | # General Public License for more details. | |
19 | # | |
20 | # You should have received a copy of the GNU General Public License | |
21 | # along with MBSE BBS; see the file COPYING. If not, write to the Free | |
22 | # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
23 | ############################################################################# | |
24 | ||
25 | ||
26 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
27 | ||
28 | umask 077 | |
29 | TZ=UTC; export TZ | |
30 | MP=/etc/passwd | |
31 | LANG=C; export LANG | |
32 | ||
20
1d18ebb9e279
Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
33 | SECUREDIR=$(mktemp -d /tmp/_securedir.XXXXXX) || exit 1 |
5 | 34 | |
35 | trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE | |
36 | ||
37 | if ! cd "$SECUREDIR"; then | |
38 | echo "Can not cd to $SECUREDIR". | |
39 | exit 1 | |
40 | fi | |
41 | ||
42 | MPBYPATH=secure1.$$ | |
43 | OUTPUT=secure2.$$ | |
44 | ||
45 | ||
46 | # These are used several times. | |
47 | # | |
48 | awk -F: '{ print $1 " " $3 " " $6 }' $MP > $MPBYPATH | |
49 | ||
50 | ||
51 | while read name uid homedir; do | |
52 | if [ -d ${homedir}/ ] && [ "`expr $uid \>= 1000`" == "1" ]; then | |
20
1d18ebb9e279
Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
53 | USAGE=$(du -s --block-size=1048576 -h $homedir 2>/dev/null | cut -f 1) |
1d18ebb9e279
Fixed permission errors on .gvfs virtual filesystems. Bumped to version 0.21
Michiel Broek <mbroek@mbse.eu>
parents:
17
diff
changeset
|
54 | SPACE=$(df -khTP $homedir | tail -n 1 | awk '{ print $3 }') |
5 | 55 | printf -- "%-16s %6s %6s $homedir\n" $name $USAGE $SPACE |
56 | fi | |
57 | done < $MPBYPATH > $OUTPUT | |
58 | if [ -s $OUTPUT ] ; then | |
59 | printf -- "\n Diskspace used by users.\n\n" | |
60 | printf -- "Username used size homedirectory\n" | |
61 | printf -- "---------------- ------ ------ -------------\n" | |
62 | cat $OUTPUT | |
63 | fi | |
64 |