1

I am trying to add Xonsh to my /etc/shellsto make it my new default shell, however when i run sudo which xonsh >> /etc/shells I get bash: /etc/shells: Permission denied I tried changing the permissions using chmod u+x /etc/shellsbut it throws changing permissions of '/etc/shells': Operation not permitted what can i do?

ᄂ ᄀ
  • 4,187

1 Answers1

1

The output redirection >> is perhaps tried to be applied by the shell before the sudo is executed, but the user shell has no permission to do that.

To avoid the error, the following two formulations might work :

sudo sh -c "echo $(which xonsh) >> /etc/shells"

echo $(which xonsh) | sudo tee -a /etc/shells

harrymc
  • 498,455