A common issue you may face when working with an SSH terminal via user webspace in Plesk or SSH client (e.g. Putty) in a chrooted environment – /bin/bash (chrooted), is that the [BACKSPACE] key is not working correctly – when you press it, it just acts as a [SPACE] button.
Other symptoms you may face along with this bug:
- Cron Jobs which are added in the “Scheduled Tasks” section of the user webspace (in a chrooted environment) may fail to execute;
- Linux commands when copy-pasted in the SSH terminal sometimes get trimmed or produce an unexpected output;
How to fix the “no backspace in a chrooted shell environment” problem
Most probably something is wrong with the terminfo database or /etc/inputrc file in your chrooted shell environment template and these files need to be replaced with a fresh copies.
This solution has been tested and confirmed as working on PLESK/AlmaLinux 8
#1 First login to your Plesk server via SSH as a root user
#2. Next you need to download a script which will allow you to manage the chroot template (if you do not already have it). Execute these two linux commands to do so:
curl -o update-chroot.sh https://raw.githubusercontent.com/plesk/kb-scripts/master/update-chroot/update-chroot.sh
chmod 700 update-chroot.sh
#3 Copy the /etc/inputrc file which is responsible for handling the keyboard mapping in console-specific situations. Use this command (it will auto-confirm the overwrite of the old file):
yes | cp /etc/inputrc /var/www/vhosts/chroot/etc/inputrc
#4 Copy the /usr/share/terminfo/ database over the version which is (or at least it should be) present in the chroot directory by using this command (it will auto-confirm the overwrite of the old directory and its files):
yes | cp -rf /usr/share/terminfo/ /var/www/vhosts/chroot/usr/share/
#5 Update the chroot template for all of your websites by using this command:
./update-chroot.sh --apply all
#6 Last step – Login back into a chrooted environment via “SSH Terminal” option in your PLESK webspace or SSH Client (such as Putty) and enjoy the changes! *If already logged in – logout and login again.
In case this solution does not work out for you, check the links down below.
References:
How to add programs to chrooted shell environment template in Plesk – Plesk Support
Backspace key doesn’t work when logged in chroot account – Plesk Forum