# Shell path for root incorrect



## Aaron_VanAlstine (Jul 10, 2009)

Oops. I was tryint to change my root shell to bash and I seem to have screwed up the path:


```
su
Password:
su: /bin/bash: No such file or directory
```

Of course, now I can't get into root to correct the path. How can I force my way into root and correct the root shell path? I'm running headless can't even reboot into single-user via ssh.


----------



## danger@ (Jul 10, 2009)

Oh my, how many times am I going to repeat myself and I explain to other people to keep the root's shell intact??

If you by any chance have security/sudo installed, that would be great for you, but I suppose you don't. Well then your only chance is to go and get your system into single user mode and fix it there.

Or if you're "lucky", you will be able to find a local root exploit for some of your software installed on your system ;-)


----------



## Aaron_VanAlstine (Jul 10, 2009)

Unfortunately, you must be root to shutdown into single-user.

Verily, I've been schooled with a hard lesson.


----------



## danger@ (Jul 10, 2009)

you don't, if you have physical access to that machine


----------



## DutchDaemon (Jul 10, 2009)

Yeah, boot in single-user mode (menu option 4), accept the shell offered (/bin/sh), type [cmd=]mount -a[/cmd] at the prompt, and use [cmd=]chsh root[/cmd] to set the path to /usr/local/bin/bash. Better still: put the root shell back to /bin/csh, and use the *toor* account for root access, and give that account a bash shell. You'll be amazed at how fast you get used to typing [cmd=]su (-) toor[/cmd] instead of [cmd=]su (-)[/cmd]. Toor is a full root account, you won't see any difference.


----------



## Aaron_VanAlstine (Jul 10, 2009)

Hideous. I will lug the darn thing into my officer and fix. Thanks!


----------



## Aaron_VanAlstine (Jul 10, 2009)

Well, dropping into single-user didn't work. I'm going to reinstall 7.2 and start all over. No problem because I just installed it yesterday and didn't have much besides apache running. I will proselytize to all who will listen not to mess with the root shell.

I'm downloading 7.2 with BitTorrent and will burn a CD and re-install. Shouldn't take too long.


----------



## SirDice (Jul 10, 2009)

Aaron_VanAlstine said:
			
		

> Well, dropping into single-user didn't work.


Why? It should work.

Do note that /bin/bash does NOT exist. Bash is not part of the base OS. If you do have bash installed via a port or package it'll be in /usr/local/bin/bash.


----------



## lme@ (Jul 10, 2009)

You can try this one:

`$ su -m root -c /usr/local/bin/bash`
Press ctrl+c and you have a bash 
Then type `# chsh` and change the shell back to /bin/csh


----------



## Aaron_VanAlstine (Jul 10, 2009)

I could drop into single-user, mount -a, but not update the shell path. It said chsh was an unrecognized command. In any event, I resinstalled from scratch and my web site is back on-line. It took about four hours but it was a useful learning experience and I appreciate all the help I received from this forum. I think FreeBSD has some of the best support in the open-source world.


----------



## Business_Woman (Jul 11, 2009)

DutchDaemon said:
			
		

> Better still: put the root shell back to /bin/csh, and use the *toor* account for root access, and give that account a bash shell. You'll be amazed at how fast you get used to typing [cmd=]su (-) toor[/cmd] instead of [cmd=]su (-)[/cmd]. Toor is a full root account, you won't see any difference.



??
There are two root acounts?


----------



## SirDice (Jul 11, 2009)

Business_Woman said:
			
		

> ??
> There are two root acounts?



Yes, root and toor. By default toor is disabled though.


----------



## DutchDaemon (Jul 11, 2009)

Give toor a shell and a password, and you're in business.


----------

