# Install using Zsh only and no other shells



## BinaryNation (May 24, 2012)

I've been searching for this and have not found an answer.

I want to install FreeBSD with Zsh as the primary default shell for all users and have it be the only shell installed, no other shells. How can I do this?

A few things, I do not have FreeBSD installed on the machine I'm going to install it on no another machine with the same architecture. In fact I don't have any of my personal computers with FreeBSD installed, I had been using other distros and at work we have FreeBSD and I have fallen in love with it and now I'm making the switch at home, so I can not use the machines at work to help build an install disc.

At my house I have x86 and AMD64 machines so I am going to have to make 2 different install discs.

Additionally for Zsh I have been using it for a long time and I would like to have my current Zshenv, Zprofile, Zshrc, and Zlogin files on the install disc so they can been copied with the install.

Thank you for all the help.


----------



## jb_fvwm2 (May 25, 2012)

sh (csh,tcsh) comes with the system, never heard of FreeBSD usage without it (them). You can however, do something as simple as 
	
	



```
echo "please type "zsh" "
```
 in a .login or some other .cshrc file. (Cannot say which is easiest or most workable or suitable for the systems you are about to configure...)


----------



## pkubaj (May 25, 2012)

You can build FreeBSD without (t)csh support by defining 
	
	



```
WITHOUT_TCSH=yes
```
 in /etc/src.conf. sh, on the other hand, is required for script execution and cannot be removed.


----------



## shitson (May 25, 2012)

Are you able to explain the point behind this? Security? Compliance?


----------



## UNIXgod (May 25, 2012)

You can create a shell script to set up new user environments. It won't stop them from compiling and installing their own shell once their on the system.

I wouldn't remove ash or tcsh from the system.

The handbook has information on creating your own custom installer with additional scripts/ports.


----------



## SirDice (May 25, 2012)

Run 
`# adduser -C`

And configure it to use the prefered shell by default. Remove the execute permissions from /usr/bin/chsh and nobody will be able to change it anymore.

Do NOT remove (t)csh, it's root's default shell. Do NOT change root's shell. Certainly not to something that came from a port. If you do you will have major issues next time you upgrade your system.

Definitely not remove /bin/sh as that will break the entire system. All scripts (including the ones needed to boot the system) use it.


----------



## BinaryNation (Sep 6, 2012)

Sorry for the late reply, I haven't been able to do much because I've been sick.  But I'm wanting to make Zsh the only shell for security reasons and compliance testing configurations at home for work.  I understand tcsh is roots default shell, of which on the machine I'm playing around with FreeBSD on I installed Zsh using the binaries, not from a port, and have made it roots shell and so far have not had any issues.  I know and understand all the scripts are made to run using /bin/sh and that is why I'm wanting to make Zsh the only shell when installing the entire system.

As for the handbook I'm going to print it out and read through it.


----------



## kpa (Sep 6, 2012)

Don't change the shell for root, FreeBSD has another root equivalent user, toor that can be customized to your heart's content without touching the root account. You first have to set a password for toor to enable the account and then change the shell for toor to zsh(1).

And do not replace /bin/sh with another shell, that's just asking for trouble.


----------



## wblock@ (Sep 13, 2012)

freemason said:
			
		

> You can of course change root's shell to sh/zsh or whatever (as root is just another user) and delete csh from system completely without actually doing any harm.
> But don't remove sh because it is used widely by system (and not only) scripts.



Changing root's shell can lead to surprises.  Like in single-user mode, for example.


----------



## xtaz (Sep 13, 2012)

I've personally changed root's shell to /usr/local/bin/bash on every single FreeBSD box I've ever installed going back to when I first started using it with version 4.1 with no issues. But if you do so you need to understand the issues and the reasons people warn you not to do this and then you can learn to do it relatively safely. Part of the problem is that in a lot of setups if you boot in single user mode or if your partitions screw up /usr/local/bin or /usr/local/lib might not be mounted which means your shell will not load and you won't be able to login to fix it.

What I do is install the shells/bash port with the option to compile it statically so it's not linked against any dynamically loaded library files, and I also just have / and /usr/local as part of the same filesystem so that it is there and mounted whilst in single user mode. However whilst I have never seen any issues running like this I am aware that there could be some at some point which is why I keep a USB stick that I can use to boot the system, mount the drive, and change the shell if any issues do occur.


----------



## chatwizrd (Sep 13, 2012)

xtaz said:
			
		

> I've personally changed root's shell to /usr/local/bin/bash on every single FreeBSD box I've ever installed going back to when I first started using it with version 4.1 with no issues.



I have done the same since 3.x and have never had a problem before. I'm sure its not recommended for many reasons, but so far I have had good luck.


----------



## BinaryNation (Oct 1, 2012)

Thanks for all the advice, I'll keep all that in mind, I've printed all the books and I'm reading through the handbook and developers guide to see what I need to change as I can modify the kernel if I need to.

As for mount points/partitions I only have /var and /home on a separate partition, a separate HDD actually, the main / partition is on a SSD of it's own and swap on an SSD of it's own.


----------

