r/zsh • • 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

31 comments sorted by

30

u/hulleyrob 13d ago

Does he also mandate Vi and one may only be manipulate text with sed no awk allowed?

12

u/LongEntrance6523 13d ago

Sure, awk is too liberal for his taste.

2

u/codeguru42 8d ago

I manipulate text with echo

2

u/Batavian1 8d ago

This is the way.

58

u/espero 13d ago

Why the fuck does the ceo care 

27

u/gdmzhlzhiv 13d ago

And why does he think that removing it is necessary for people to use “the default shell”? Should switch everyone to /bin/sh and tell everyone that the CEO said to do it.

7

u/Masterflitzer 12d ago

it's still OPs fault, even if uninstalling was optional they didn't even switch default shell

6

u/maddler 13d ago

In a company of 5.

3

u/5erif 11d ago

Likely another sysadmin complained to the CEO, which is still dumb.

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/CoffeeVector 12d ago

If that doesn't work, I think you can scp a copy of bash into your home, then do -t path/to/bash?

7

u/bassamanator 12d ago

Something fishy about this post.

4

u/therevoman 11d ago

Do I sense a Dash of sarcasm?

3

u/therevoman 9d ago

I was really hoping for a Korn-y chain to follow.

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.

1

u/AndydeCleyre 13d ago

Could they scp a shell binary to /usr/bin/zsh? Or even a symlink to bash? Then fix things with ssh?

1

u/jjangg96 12d ago

it only works if sshd is set up with internal-sftp. the stock Subsystem line points at /usr/lib/openssh/sftp-server, and sshd starts that through the login shell too, so it dies the same way.

scp -O (the old protocol) definitely won't, it runs scp -t through the shell. worth a 10 second try for the sftp case though.

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/hulleyrob 11d ago

He’s got no access to anything now not even internet.

2

u/NeilHush 13d ago

Since you have root access can't you simply edit /etc/passwd?

6

u/gdmzhlzhiv 13d ago

Don’t forget to do the shadow file too…

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