-
Notifications
You must be signed in to change notification settings - Fork 4
/
securetty.sh
executable file
·40 lines (38 loc) · 1.47 KB
/
securetty.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
########################################################################
# securetty.sh: Script to Clear /etc/securetty for Unrestricted Root Access
#
# Description:
# This script checks if /etc/securetty is a regular file and clears its content
# to enable root login from any TTY device. This might be necessary for certain
# system administration tasks or policy changes.
#
# Warning:
# Using this script can decrease system security by allowing root access from any
# terminal. It should only be used when absolutely necessary and in secure environments.
# This script does nothing if /etc/securetty is a directory, which might be the case
# in some systems like macOS.
#
# Author: id774 (More info: http://id774.net)
# Source Code: https://github.com/id774/scripts
# License: LGPLv3 (Details: https://www.gnu.org/licenses/lgpl-3.0.html)
# Contact: [email protected]
#
# Version History:
# v1.1 2023-11-30
# Added check to ensure /etc/securetty is a file before clearing it.
# v1.0 2012-05-21
# Initial release. Script to clear /etc/securetty for unrestricted root access.
#
# Usage:
# Run the script without any arguments:
# ./securetty.sh
#
########################################################################
if [ -f /etc/securetty ]; then
sudo sh -c ": > /etc/securetty"
elif [ -d /etc/securetty ]; then
echo "/etc/securetty is a directory, no changes were made."
else
echo "/etc/securetty does not exist as a file or directory."
fi