Corrects sudo authentication errors on back up restore (Debian 11)

PHOTO EMBED

Mon Oct 03 2022 15:21:18 GMT+0000 (Coordinated Universal Time)

Saved by @atatimelikethis #permissions #shell #backup

# Deal with sudo authentication errors on back up
# two write permissions errors on backup restore:
# 1. check chown and chmod of sudo 
# 2. sudo: /usr/bin/sudo must be owned by uid 0 
# 3. and have the setuid bit set

# 1. sudo ownership
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

# 2. UID ownership
grep root /etc/passwd
# the default root should be set to:
# root:x:0:0:root:/root:/bin/bash
# if not sudoedit as above.

# 3. setuid bit
# check /usr/bin for setuid bit errors (vs. clean normal installation of distro)
# (for debian 11) incorrect configuration includes su and sudo and 8 other executables
# Incorrect format is (compare first 4 permsissions) 
# -rwxr-xr-x 1 root root 179K Feb 27 2021 sudo
# correct format is 
# -rwsr-xr-x 1 root root 182600 Feb 27  2021 /usr/bin/sudo
# prefer pkexec to nake changes 
pkexec chmod a=rx,u+ws /usr/bin/sudo
pkexec chmod a=rx,u+ws /usr/bin/su
# compare vs. a unmodified fresh virtual install of your system
# in Debian 11 8 further files need modifying

# bonus. on your way out check permissing in  /usr/lib/sudo/ and compare with base install.
content_copyCOPY