
08-04-2006, 01:44 PM
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
HOWTO: Properly use BASH as your login shell for root.
I'll make this my introductory post. I'm Ryan, I've been using FreeBSD since 2.2.7, along with Slackware since 4, and Red Hat since 5.2 (no longer use Slack or RH though).
I'm not sure if most of you know, but bash is installed into /usr/local/bin/bash.
The old school train of thought (mine, and many others) is that if /usr ever becomes unmountable, you cannot log in as root if it's your default shell (via chsh).
A quick trick for this is to call bash from your .cshrc file. You could call it from .login too, but that doesn't get read if you su to root.
Simply adding this to your .cshrc will allow you to use bash (assuming it is installed) as your shell.
|
Code:
|
if (-x /usr/local/bin/bash) then
exec /usr/local/bin/bash --login
endif |
This will call bash when you log in as root, or su in from another user.
The implications of this, however is that the KDE su commands that run when you run PBI updates or want to change stuff in the system configurator seem to hang. I haven't found a way around this yet... but as an old school user I'm more inclined to use the command prompt over a GUI anyway.
Well thanks for listening. If you have anything to add in or comment about please feel free. Just remember to be safe when using root.
Of course don't forget to customize your bash with a .bash_profile and a .bashrc.
|
|

08-04-2006, 02:00 PM
|
|
Senior Member
|
|
Join Date: May 2006
Location: Greater State of Northern Kaliforneea
Posts: 2,880
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Thanks for the tip. Nice to see one more long time user join the community.
|
|

08-06-2006, 02:53 AM
|
|
Senior Member
|
|
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Generally if I want to use a diffrent shell then csh I run it after login gives me a prompt.
I enjoyed bash, but tcsh has gotten me hooked.
|
|

08-06-2006, 03:05 AM
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by TerryP
|
Generally if I want to use a diffrent shell then csh I run it after login gives me a prompt.
I enjoyed bash, but tcsh has gotten me hooked.
|
That's all this does, when csh loads .csh, it calls bash. no big deal. you could do the same with tcsh.
|
|

08-06-2006, 07:44 AM
|
 |
Super Moderator
|
|
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by Mindflux
|
|
Originally Posted by TerryP
|
Generally if I want to use a diffrent shell then csh I run it after login gives me a prompt.
I enjoyed bash, but tcsh has gotten me hooked.
|
That's all this does, when csh loads .csh, it calls bash. no big deal. you could do the same with tcsh.
|
Hereis good tutorial about how to change default shell in FreeBSD. Another one is here.
|
Quote:
|
The original developers of BSD preferred csh to Bourne style shells.
So, at some point it was decided that /bin should only have two shells,
csh and sh. Remember disk space was far more precious then. Because
the original developers preferred csh, the version of csh put in
/bin was actually tcsh, a version of csh with tab completion, history
scrolling and the like. (The interested reader can see this by doing a
ls -i for csh and tcsh. They have the same inode.)
|
Read more here.
__________________
"All parts should go together without forcing. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer." -- IBM maintenance manual, 1975
|
|

08-07-2006, 05:00 PM
|
|
Junior Member
|
|
Join Date: Aug 2006
Location: Slovakia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Simply
# echo $SHELL
View my shell
# cat /etc/passwd
View all user's shell
# cat /etc/shells
List of acceptable shells
# chsh -s /usr/local/bin/bash
Change shell
|
|

08-07-2006, 06:37 PM
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by antik
|
|
Originally Posted by Mindflux
|
|
Originally Posted by TerryP
|
Generally if I want to use a diffrent shell then csh I run it after login gives me a prompt.
I enjoyed bash, but tcsh has gotten me hooked.
|
That's all this does, when csh loads .csh, it calls bash. no big deal. you could do the same with tcsh.
|
Hereis good tutorial about how to change default shell in FreeBSD. Another one is here.
|
Quote:
|
The original developers of BSD preferred csh to Bourne style shells.
So, at some point it was decided that /bin should only have two shells,
csh and sh. Remember disk space was far more precious then. Because
the original developers preferred csh, the version of csh put in
/bin was actually tcsh, a version of csh with tab completion, history
scrolling and the like. (The interested reader can see this by doing a
ls -i for csh and tcsh. They have the same inode.)
|
Read more here.
|
Yes, I know how to change shells. The point of calling it from .cshrc or .shrc (whichever your shell) is that if /usr ever becomes UNMOUNTABLE, you can still use csh or sh since they exist in /bin, rather than /usr/local/bin. If the original post had been read, you would have known that.. however.
If you change your shell permanently to bash, have problems mounting usr.. you have no way to get into the root user account to try and fix the drive problems.
|
|

08-07-2006, 09:34 PM
|
 |
Super Moderator
|
|
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by Mindflux
|
Yes, I know how to change shells. The point of calling it from .cshrc or .shrc (whichever your shell) is that if /usr ever becomes UNMOUNTABLE, you can still use csh or sh since they exist in /bin, rather than /usr/local/bin. If the original post had been read, you would have known that.. however.
If you change your shell permanently to bash, have problems mounting usr.. you have no way to get into the root user account to try and fix the drive problems.
|
That's why I never use bash and I see no benefits from bash anyway.
__________________
"All parts should go together without forcing. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer." -- IBM maintenance manual, 1975
|
|

08-07-2006, 10:38 PM
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by antik
|
That's why I never use bash and I see no benefits from bash anyway.
|
Ok, that's fine. But can you atleast instruct users how to change it safely (per my howto). Now the thread has been officially sh1t on.
|
|

08-07-2006, 10:49 PM
|
 |
Super Moderator
|
|
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Originally Posted by Mindflux
|
|
Originally Posted by antik
|
That's why I never use bash and I see no benefits from bash anyway.
|
Ok, that's fine. But can you atleast instruct users how to change it safely (per my howto). Now the thread has been officially sh1t on.
|
One solutin is to copy bash into /bin/bash. But we may include your script in upcoming releases.
__________________
"All parts should go together without forcing. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer." -- IBM maintenance manual, 1975
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 06:51 AM.
|
|