Change Username¶
Enable Root Login¶
passwd root
sed -re 's/^#?(PermitRootLogin .*)/#\1\nPermitRootLogin yes # delete-me/' -i /etc/ssh/sshd_config
systemctl restart ssh
Change Username and Password¶
Login as root
, and do the following:
sed -re "s/^pi /${NEW_USER} /" -i /etc/sudoers.d/010_pi-nopasswd
mv /home/pi "/home/${NEW_USER}"
usermod pi -l "${NEW_USER}" -d "/home/${NEW_USER}"
groupmod pi -n "${NEW_USER}"
passwd "${NEW_USER}"
Logout and Login as ${NEW_USER}
.
Disable Root Login¶
usermod root -p '*'
sed -re '/^PermitRootLogin .+ # delete-me$/d' -i /etc/ssh/sshd_config
systemctl restart ssh