Poor man's chsh
I have this set of machines on which my default shell is sh
, which sucks, so I always start bash
the first thing I do. When it's time to disconnect I exit bash
and then I have to exit sh
as well. Undelightful.
Normally you could change your default shell with chsh
or usermod
. But if chsh
won't work for whatever reason and if you don't have root access, then what?
echo 'bash && exit' >> ~/.profile
That's really all there's to it. Let's see how it works.
When you connect to the machine by SSH, then ~/.profile
will be executed. With this code it will first run bash and give your that delicious shell for your session. When you exit that, it will trigger the &&
and consequentially run exit
to kill your sh
shell.
Profit!
Written by Tobias Sjösten
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#