Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Want to replace bash w zsh as system shell on Ubuntu



Replacing the system shell is not a very good advice. Recent versions of 
ubuntu use dash (debian almquist shell) not bash as it's default shell.

Dash is a minimalistic posix shell which doesn't provide much builtin 
commands. It's considered faster than bash. Ubuntu uses dash to speed up the 
booting process.

Replacing the default system shell (the shell getting started via /bin/sh) can 
be harmful. Some init scripts may stop working. Therefore it's not a good idea 
to change default system shell. DON'T do it unless you're completely sure all 
init scripts will work with zsh.


Running "sudo -s" will start a root session of using the shell specified 
within the environmental variable SHELL.

To start a root session using zsh run:     SHELL=zsh sudo -s
to start a root session using bash run:    SHELL=sh sudo -s
to start a root session using dash run:    SHELL=dash sudo -s

In most cases it's enough to start a session using your current shell by 
running "sudo -s" unless you exported a different SHELL in your startup 
scripts.

If you get the error message "sudo: shell: command not found" it's very likely 
you misconfigured your shell. Calling:
  SHELL=/bin/non_existent_shell sudo -s
  sudo: shell: command not found
will cause such an error message.

The wisest thing to do is revert all the changes you've made and try running
"sudo -s" while you're in a zsh shell. If you don't get a root session you 
shell you should check if your startup scripts export a different shell via.

Using a fresh ubuntu install you can just start a zsh root session from within 
a zsh user session by running "sudo -s". If you can't you have misconfigured 
your ubuntu.


On Tuesday 02 February 2010 09:15:47 rj wrote:
> In the couple of months I've been using Ubuntu at home, I've discovered
> I need to use the "sudo" command almost daily for administrative changes
> and systemwide, non-user-specific tasks and so on.
> 
> I've already set up zsh as my user shell, but the system default shell is
> bash, and whenever I do a "sudo" I'm wrenched out of my familiar customized
> zsh environment into a raw, minimally-config'd bash.
> 
> Accordingly, I'd like to make zsh the system shell as well as having it be
> my user shell.  (I'm the only user on the system.)
> 
> I already have, in /etc/zsh/, a .zprofile, .zshenv and .zshrc, copied from
> my homedir.  (Obviously some necessary tweaks & changes will have to be
> made in them.)
> 
> My question is, (a) should those files be: /etc/.zprofile, etc/.zshenv and
> /etc/.zshrc, or is having them in an /etc/zsh/ subdir ok?
> 
> and (b) (my main question), what exactly is the instruction-command(s) I'd
> use to tell the system to run zsh instead of bash as the system shell, and
> where would I need to put it?
> 
> also (c), is there any reason I'd need, for this, to put any zsh config
> files in the /root directory?  I had one there briefly and just noticed
> that I still have a .zcompdump file there.  (Perhaps zsh configs are
> necessary there to start a root shell.  I'm a bit fuzzy on this stuff --
> for years I've only used zsh via ssh on other systems, and only as a user.)
> 
> I think I want zsh to be the operative shell in all situations (unless that
> would for some reason be imprudent), like on the infrequent occasion when
> I also do a "sudo su -" (i.e., start a root shell).
> 
> Though just now I saw this:
> 
> "To start a root shell, but keep the current shell's environment, use:
> sudo -s  (similar to sudo su)"
> 
> (where "sudo i" give you root's environment configuration.)
> 
> But "sudo -s", for me, returns "sudo: shell: command not found"
> 
> Thanks for any clarity on these issues.
> 

Attachment: signature.asc
Description: This is a digitally signed message part.



Messages sorted by: Reverse Date, Date, Thread, Author