mirror of
https://github.com/armbian/configng.git
synced 2026-01-06 10:37:41 -08:00
31 lines
818 B
Bash
31 lines
818 B
Bash
module_options+=(
|
|
["toggle_ssh_lastlog,author"]="@Tearran"
|
|
["toggle_ssh_lastlog,ref_link"]=""
|
|
["toggle_ssh_lastlog,feature"]="toggle_ssh_lastlog"
|
|
["toggle_ssh_lastlog,desc"]="Toggle SSH lastlog"
|
|
["toggle_ssh_lastlog,example"]="toggle_ssh_lastlog"
|
|
["toggle_ssh_lastlog,status"]="Active"
|
|
)
|
|
#
|
|
# @description Toggle SSH lastlog
|
|
#
|
|
function toggle_ssh_lastlog() {
|
|
|
|
if ! grep -q '^#\?PrintLastLog ' "${SDCARD}/etc/ssh/sshd_config"; then
|
|
# If PrintLastLog is not found, append it with the value 'yes'
|
|
echo 'PrintLastLog no' >> "${SDCARD}/etc/ssh/sshd_config"
|
|
srv_restart ssh
|
|
else
|
|
# If PrintLastLog is found, toggle between 'yes' and 'no'
|
|
sed -i '/^#\?PrintLastLog /
|
|
{
|
|
s/PrintLastLog yes/PrintLastLog no/;
|
|
t;
|
|
s/PrintLastLog no/PrintLastLog yes/
|
|
}' "${SDCARD}/etc/ssh/sshd_config"
|
|
srv_restart ssh
|
|
fi
|
|
|
|
}
|
|
|