Вы не можете сделать ничего из того, что вы описали.
Вы находитесь на sftp с непривилегированным пользователем, и если бы можно было изменить файлы, которые бы разрешили root-доступ, это было бы огромным недостатком безопасности.
Рассмотрите функцию ловушки для проверки команды перед добавлением в файл истории:
zshaddhistory() {
case ${1%% *} in
(mpv|mpc) return 1;;
esac
return 0;
}
Цитирование раздела справочной страницы(man zshmisc
в разделе «Функции ловушек»):
If any of the hook functions returns status 1 (or any non-zero value other than 2, though this is not guaranteed for future versions of the shell) the history line will not be saved, although it lingers in the history until the next line is executed, allowing you to reuse or edit it immediately.
If any of the hook functions returns status 2 the history line will be saved on the internal history list, but not written to the history file. In case of a conflict, the first non-zero status value is taken.