Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2006, 01:44 PM
Mindflux Mindflux is offline
Junior Member
 
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

Reply With Quote
  #2  
Old 08-04-2006, 02:00 PM
dracheflieger dracheflieger is offline
Senior Member
 
Join Date: May 2006
Location: Greater State of Northern Kaliforneea
Posts: 2,880
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Thanks for the tip. Nice to see one more long time user join the community.
Reply With Quote
  #3  
Old 08-06-2006, 02:53 AM
TerryP TerryP is offline
Senior Member
 
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TerryP Send a message via AIM to TerryP Send a message via Yahoo to TerryP
Default
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.
Reply With Quote
  #4  
Old 08-06-2006, 03:05 AM
Mindflux Mindflux is offline
Junior Member
 
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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.
Reply With Quote
  #5  
Old 08-06-2006, 07:44 AM
antik's Avatar
antik antik is offline
Super Moderator
 
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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
Reply With Quote
  #6  
Old 08-07-2006, 05:00 PM
stranger stranger is offline
Junior Member
 
Join Date: Aug 2006
Location: Slovakia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #7  
Old 08-07-2006, 06:37 PM
Mindflux Mindflux is offline
Junior Member
 
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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.
Reply With Quote
  #8  
Old 08-07-2006, 09:34 PM
antik's Avatar
antik antik is offline
Super Moderator
 
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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
Reply With Quote
  #9  
Old 08-07-2006, 10:38 PM
Mindflux Mindflux is offline
Junior Member
 
Join Date: Aug 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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.
Reply With Quote
  #10  
Old 08-07-2006, 10:49 PM
antik's Avatar
antik antik is offline
Super Moderator
 
Join Date: Jul 2005
Location: Estonia
Posts: 3,610
Thanks: 0
Thanked 0 Times in 0 Posts
Default
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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant login as root gamester Installing PC-BSD 2 12-25-2006 07:56 PM
login as root on KDE Disruptive_Nature General Questions 17 04-08-2006 11:29 AM
Making BASH the default shell JMan General Questions 5 03-27-2006 11:23 PM
Root login in KDE jaideep_jdof General Questions 5 12-14-2005 03:04 AM
Should the bash shell be included in the base release? sblevin Feature Requests 4 07-23-2005 12:37 PM


All times are GMT. The time now is 06:51 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.