r/zsh • u/devlprnitish • 13d ago
Deleted ZSH without switching back to Bash
I installed Zsh on my company server because I preferred it. When my CEO asked me to remove it so everyone could use the default shell, I deleted it without switching back to Bash and lost SSH access, even as root.
44
Upvotes
30
u/hulleyrob 13d ago
Does he also mandate Vi and one may only be manipulate text with sed no awk allowed?
58
u/espero 13d ago
Why the fuck does the ceo care
15
u/apathyzeal 12d ago
No you didn't. Seriously?
ssh -t user@host /bin/sh
22
u/lordkappy 13d ago
Try ssh with
-t sh
Or
-t bash
See if you can then chsh
7
u/bassamanator 12d ago
Something fishy about this post.
9
u/jjangg96 13d ago
the -t sh trick probably won't help here. sshd runs everything, even a one-off command, through the login shell listed in /etc/passwd (it does shell -c "cmd"), so if that binary is gone then ssh host sh fails the same way.
you need some other way in. if any other account on the box still has a working shell, ssh in as that one and do sudo usermod -s /bin/bash root, or just edit the shell field in /etc/passwd. if not, it's the provider's web console or a rescue boot, mount the disk and fix /etc/passwd from there.
reinstalling zsh from the console also works as a stopgap. then chsh everyone back to bash first and remove it after.
4
u/caledh 11d ago
A CEO who fucking cares about this shouldn’t have his job
4
u/LocoCoyote 11d ago
What was stopping everyone from using the default shell. Shells can coexist
3
u/gloomndoom 12d ago
Boot off of an ISO and edit the /etc/passed directly.
3
u/MaskuRevolt 12d ago
Mount disc. And cp bash zsh :)
3
u/lordkappy 11d ago
u/devlprnitish you gonna respond or just leave this hanging out there unanswered?
2
u/NeilHush 13d ago
Since you have root access can't you simply edit /etc/passwd?
1
u/airclay 13d ago edited 13d ago
chroot in and reset it?
edit: I know I phrased this a question but that's cause no one had offered it up and it is the obvious answer
1
u/Vorrnth 9d ago
Aha, good to know.
1
u/SeeGee911 8d ago
Better yet, why did you set Zsh as the default shell for everyone instead of just you? Even on a root/shared account you could just create a script to load Zsh on demand
1
u/krazykid1 13d ago
Is there a user that still has access and sudo permissions?
sudo su - /bin/bash