Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install oh-my-zsh on openwrt/lede-project
opkg update && opkg install ca-certificates zsh curl git-http
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 
sed -i -- 's:/bin/ash:/usr/bin/zsh:g' /etc/passwd


# -- reboot, all done. 
@mlouielu

This comment has been minimized.

Copy link

@mlouielu mlouielu commented Jan 2, 2018

Awesome, thanks!

step 4 edit can changed to use this:
sed -i -- 's/ash/zsh/g' /etc/passwd

@fire1ce

This comment has been minimized.

Copy link
Owner Author

@fire1ce fire1ce commented Feb 20, 2018

Thanks for the star and suggestions. I don't have a OpenWrt/Lede to make sure its works.

@jqqqqqqqqqq

This comment has been minimized.

Copy link

@jqqqqqqqqqq jqqqqqqqqqq commented Mar 4, 2018

On my 17.01.4,ca-bundle should be installed, otherwise curl reports:
curl: (77) Error reading ca cert file /etc/ssl/certs/ca-certificates.crt - mbedTLS: (-0x3E00) PK - Read/write of file failed

@fire1ce

This comment has been minimized.

Copy link
Owner Author

@fire1ce fire1ce commented Mar 17, 2018

updated the gist to include "ca-bundle" installation

@mlouielu

This comment has been minimized.

Copy link

@mlouielu mlouielu commented Mar 26, 2018

Hi @fire1ce, this line should change to use this:

sed -i -- 's/ash/zsh/g' /etc/passwd

to

sed -i -- 's:/bin/ash:/usr/bin/zsh:g' /etc/passwd

Otherwise it will reject user to login from ssh

@fire1ce

This comment has been minimized.

Copy link
Owner Author

@fire1ce fire1ce commented Mar 26, 2018

@mlouielu thanks. change been applied to the gist.

@moorer2k

This comment has been minimized.

Copy link

@moorer2k moorer2k commented Sep 12, 2018

Great script, I had to modify the sed command to work for my Pineapple Tetra, which runs off OpenWRT also.

Changed:

sed -i -- 's:/bin/ash:/usr/bin/zsh:g' /etc/passwd

to

sed -i -- 's:/bin/ash:/bin/zsh:g' /etc/passwd

Adding the /usr/ segment would prevent logging in at all.

But, thanks for the provided script! Saved so much time!

@mlouielu

This comment has been minimized.

Copy link

@mlouielu mlouielu commented Sep 16, 2018

maybe it should use which zsh to determine the path, like this:

$ which zsh && sed -i -- 's:/bin/ash:'`which zsh`':g' /etc/passwd
@TommyMacMoo

This comment has been minimized.

Copy link

@TommyMacMoo TommyMacMoo commented May 10, 2019

Cool, works also under OpenWrt 18.06.2
this worked for me:
->
opkg update && opkg install ca-certificates zsh curl git-http
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sed -i -- 's:/bin/ash:/usr/bin/zsh:g' /etc/passwd

logged out, and in again, and Oh-My-ZSH was working ------------------>Thanks

@reancool

This comment has been minimized.

Copy link

@reancool reancool commented Feb 27, 2020

Cool, works also under OpenWrt 18.06.2
this worked for me:
->
opkg update && opkg install ca-certificates zsh curl git-http
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sed -i -- 's:/bin/ash:/usr/bin/zsh:g' /etc/passwd

logged out, and in again, and Oh-My-ZSH was working ------------------>Thanks

which zsh
/usr/bin/zsh
i edit /etc/passwd. change ash's path to zsh's path.
i cannot ssh login anymore.
"Permission denied, please try again."
i can web login.

@dpvpro

This comment has been minimized.

Copy link

@dpvpro dpvpro commented May 28, 2020

Thanks. Works on OpenWrt 19.07.3.

@ryaniskira

This comment has been minimized.

Copy link

@ryaniskira ryaniskira commented Jul 24, 2020

@reancool. Delete /etc/passwd and /etc/shadow then reboot the router. It will recreate those files from scratch and you will be able to ssh again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.