cant you set bash as the login shell?

This is a discussion on cant you set bash as the login shell? within the BSD forums, part of the Other OS category; in install, i tried to set bash as the login shell and got a error -only sh?? whys this - why cant i simply use bash for eveything to do ...

Go Back   Unix Linux Forum > Unix > Other OS > BSD

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
Reply

 

Thread Tools
  #1  
Old 08-26-2008, 09:53 AM
Default cant you set bash as the login shell?

in install, i tried to set bash as the login shell and got a error -only
sh?? whys this - why cant i simply use bash for eveything to do with
console?
if i can do like this then can you tell me how to do it cause i am a
learner on this.
Reply With Quote
  #2  
Old 08-26-2008, 09:57 AM
Default Re: cant you set bash as the login shell?

NVangogh wrote:
> in install, i tried to set bash as the login shell and got a error -only
> sh?? whys this - why cant i simply use bash for eveything to do with
> console?


What exactly did you do and what exactly was the error?

> if i can do like this then can you tell me how to do it cause i am a
> learner on this.


This should do it:

pkg_add -r bash
chsh -s /usr/local/bin/bash

- Philip

--
Philip Paeps Please don't email any replies
philip@paeps.cx I follow the newsgroup.

* azz notes that BT have just fixed our ADSL, so the "couple of days"
might actually be true as of now
"Oct 4 19:13:00 veloci pppd[11027]: Connection terminated."
[netsplit follows...]
Reply With Quote
  #3  
Old 08-26-2008, 10:31 AM
Default Re: cant you set bash as the login shell?

In article
NVangogh writes:
>in install, i tried to set bash as the login shell and got a error -only
>sh?? whys this - why cant i simply use bash for eveything to do with
>console?


Philip already handled how (though you may also need to add bash
to /etc/shells). The main answer to why is that bash isn't part
of the base system. You can't specify that it is your shell until
after it is installed.

I just looked at my 7.0 system and only find bash in /usr/compat/linux/bin.
There's also a port for it, but I haven't had any reason to install it.

--
Drew Lawson | Though it's just a memory,
| some memories last forever
Reply With Quote
  #4  
Old 08-26-2008, 02:10 PM
Default Re: cant you set bash as the login shell?

On Tue, 26 Aug 2008 14:31:40 +0000 (UTC), drew@furrfu.invalid (Drew Lawson) wrote:
> In article
> NVangogh writes:
>>in install, i tried to set bash as the login shell and got a error -only
>>sh?? whys this - why cant i simply use bash for eveything to do with
>>console?

>
> Philip already handled how (though you may also need to add bash to
> /etc/shells). The main answer to why is that bash isn't part of the
> base system. You can't specify that it is your shell until after it
> is installed.


Because nobody wants to go through the trouble of importing a snapshot
of bash in src/ *and* maintaining it as the upstream developers fix
bugs, add new features, update the documentation and so on. Installing
it from /usr/ports is so easy that it's not worth all the trouble

> I just looked at my 7.0 system and only find bash in
> /usr/compat/linux/bin. There's also a port for it, but I haven't had
> any reason to install it.


That is a Linux binary. It is used by the Linux compatibility shims,
and it is useful for running all the Linux scripts that assume bash
lives in /bin, but not for much else. If you want a native FreeBSD
version of bash, it's a better idea to pkg_add it.

Reply With Quote
  #5  
Old 08-26-2008, 03:02 PM
Default Re: cant you set bash as the login shell?

In our last episode, , the
lovely and talented NVangogh broadcast on comp.unix.bsd.freebsd.misc:

> in install, i tried to set bash as the login shell and got a error -only
> sh?? whys this - why cant i simply use bash for eveything to do with
> console?


You can, but you must install bash from the ports. Since bash is not
part of the core system, it may not be available in an emergency. For
that reason, it is best to use 'toor' as the bash-shell superuser (which
is the purpose of the toor account), so root retains csh as its shell for
emergency use. There is no reason other users should not use bash.

> if i can do like this then can you tell me how to do it cause i am a
> learner on this.


First install bash from /usr/ports/shells. Note: bash is installed in
/usr/local/bin.

If you want to change the shell for a large number of accounts, it may be
easier to edit master.passwd directly with vipw (change the environmental
variable EDITOR to a editor you are comfortable with first, if you do not
know vi). But if you are not familiar with this, it is safer to use chsh:
see the man page --- at least backup master.passwd first if you have never
edited it before.


--
Lars Eighner SAVE BEASTIE! "What do you do when you're debranded?"
usenet@larseighner.com http://larseighner.com/
"Stale dependency": When pkgdb -F reports this, it means the dependency is
missing, not that the dependency is obsolete.
Reply With Quote
  #6  
Old 08-27-2008, 08:04 PM
Default Re: cant you set bash as the login shell?

I had it already installed as a port and i wanted to know how to set it
as my default login & session shell.
(in case someone wants to do it in the future)

1.Bash does not support the ^ as a synonym for the pipe identifier |
but it is compatible with sh in all other respects. To make certain there
would be no problems using it in bsd, I first ran a script to check that
^ were not used by the sh for any piping operations:

IFS=:
for d in $PATH; do
echo checking $d:
cd $d
scripts=$(file * | grep 'shell script' | cut -d: -f1)
for f in $scripts; do
grep '\^' $f /dev/null
done
done

....it returned a few instances of ^ but not relating to piping. The way
was clear for me to install bash and banish sh.

2.I moved the bash binary to /bin/shells (simply cp /usr/local/bin/bash
to the standard shells dir. I kept the original in local though it would
not matter if i delete it).

3. Then i created a symbolic link from sh to point to bash rather than
delete sh - in the highly unlikely event that i'll ever want to use it
again.

4.finally ran the chsh/chpass program. The man page warned against
editing the master.passwd file - indeed it says that it cannot be edited
even by root. I dont know - i never needed to try.

Thats it.My New Bash shell works fine. I wish to thank those who took the
time to try to assist me with this question.

Reply With Quote
  #7  
Old 08-27-2008, 10:27 PM
Default Re: cant you set bash as the login shell?

NVangogh wrote:
: I had it already installed as a port and i wanted to know how to set it
: as my default login & session shell.
: (in case someone wants to do it in the future)
:
I think it is safer to edit the password file with "vipw",
copy the "/bin/sh" root entry to a different name, and change
"/bin/sh" to "/usr/local/bin/bash".

Now, this will not work for single user, which is why it is
important to have a root password entry that uses "sh" or "csh",
at least until you can get the filesystem(s) mounted.

Bruce
--
------------------------------------------------------------------------
"I like bad!" Bruce Burden Austin, TX.
- Thuganlitha
The Power and the Prophet
Robert Don Hughes

Reply With Quote
  #8  
Old 08-28-2008, 08:49 AM
Default Re: cant you set bash as the login shell?

In article <48b5eb74$1_2@mk-nntp-2.news.uk.tiscali.com>
NVangogh writes:
>I had it already installed as a port and i wanted to know how to set it
>as my default login & session shell.


Lots of people do, but what you have done is way more than change
your login shell. You've changed what /bin/sh is for every shell
script run by any user (real or deamon) on that system. I'm guessing
many of those scripts will not have been tested with bash, so you
could get unexpected breakage.

But it's your system. You can do what you want.


>2.I moved the bash binary to /bin/shells (simply cp /usr/local/bin/bash
>to the standard shells dir. I kept the original in local though it would
>not matter if i delete it).


I'm out of touch with a lot of stuff. Where is /bin/shells a
standard directory? I've never heard of it. Looking at the FreeBSD
7.0 and Solaris windows I have within reach, I don't see it on
either machine.


--
|Drew Lawson | Mrs. Tweedy! |
| | The chickens are revolting! |
Reply With Quote
  #9  
Old 08-28-2008, 09:14 AM
Default Re: cant you set bash as the login shell?

In our last episode, , the lovely and talented
Drew Lawson broadcast on comp.unix.bsd.freebsd.misc:

> In article <48b5eb74$1_2@mk-nntp-2.news.uk.tiscali.com>
> NVangogh writes:
>>I had it already installed as a port and i wanted to know how to set it
>>as my default login & session shell.


> Lots of people do, but what you have done is way more than change
> your login shell. You've changed what /bin/sh is for every shell
> script run by any user (real or deamon) on that system. I'm guessing
> many of those scripts will not have been tested with bash, so you
> could get unexpected breakage.


> But it's your system. You can do what you want.



>>2.I moved the bash binary to /bin/shells (simply cp /usr/local/bin/bash
>>to the standard shells dir. I kept the original in local though it would
>>not matter if i delete it).


> I'm out of touch with a lot of stuff. Where is /bin/shells a
> standard directory? I've never heard of it. Looking at the FreeBSD
> 7.0 and Solaris windows I have within reach, I don't see it on
> either machine.


There is no such place in the standard heirarchy. This whole arrangement
seems like a bad idea, especially as there is a ready-made bash superuser.
However, anyone bound and determined to do it should compile bash
statically, at the very least.


--
Lars Eighner SAVE BEASTIE! "What do you do when you're debranded?"
usenet@larseighner.com http://larseighner.com/
GNUS would be the best newsreader in the world if it had a good text editor.
Reply With Quote
  #10  
Old 08-28-2008, 09:19 AM
Default Re: cant you set bash as the login shell?

Begin <48b5eb74$1_2@mk-nntp-2.news.uk.tiscali.com>
On 28 Aug 2008 01:04:04 +0100, NVangogh wrote:
[snip!]
> ...it returned a few instances of ^ but not relating to piping. The way
> was clear for me to install bash and banish sh.


Why you'd want to ``banish sh'' is unclear to me. The system needs sh,
and as you say you only want to use bash as your login shell (and I
sincerely hope your normal login name is not ``root'').


> 2.I moved the bash binary to /bin/shells (simply cp /usr/local/bin/bash
> to the standard shells dir. I kept the original in local though it would
> not matter if i delete it).
>
> 3. Then i created a symbolic link from sh to point to bash rather than
> delete sh - in the highly unlikely event that i'll ever want to use it
> again.


Entirely unnecessairy steps, prone to cause breakage, and likewise I
am not aware of any standard that specifies a ``standard shells dir''.

``Higly unlikely'' in this case wouldn't be unlikely to be spelled as
``on the next reboot'', ``at the next periodic run from cron'', or
something similar. As pointed out by Drew already, the system is not
written with bash in mind, but with sh.

That _shouldn't_ be a problem, unless someone goes out of their way to
complicate an otherwise straightforward procedure. In that case, expect
more obscure problems down the road.


> 4.finally ran the chsh/chpass program. The man page warned against
> editing the master.passwd file - indeed it says that it cannot be edited
> even by root. I dont know - i never needed to try.


Because a number of other files, including files in a binary database
format, are generated from master.passwd. vipw and chsh will let you
edit the information therein, update master.passwd, run some consistency
checks, and generate the other files from it, automatically.


All you need to do is:

1) install bash, which'll end up in /usr/local/bin/bash
2) add a line saying /usr/local/bin/bash to /etc/shells
3) run chsh to update your normal user account and only that

This _should_ be in the handbook somewhere, and probably is.


--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.
Reply With Quote
  #11  
Old 08-28-2008, 09:35 AM
Default Re: cant you set bash as the login shell?

In article
jpd writes:

>All you need to do is:
>
>1) install bash, which'll end up in /usr/local/bin/bash
>2) add a line saying /usr/local/bin/bash to /etc/shells
>3) run chsh to update your normal user account and only that
>
>This _should_ be in the handbook somewhere, and probably is.


Section 3.9.1
http://www.freebsd.org/doc/en_US.ISO...ok/shells.html

Cleverly hidden under: UNIX Basics / Shells.

--
|Drew Lawson | If you're not part of the solution |
| | you're part of the precipitate. |
Reply With Quote
  #12  
Old 08-28-2008, 12:24 PM
Default Re: cant you set bash as the login shell?

On Thu, 28 Aug 2008 12:49:32 +0000, Drew Lawson wrote:

> Lots of people do, but what you have done is way more than change your
> login shell. You've changed what /bin/sh is for every shell script run
> by any user (real or deamon) on that system.


> I'm guessing many of those
> scripts will not have been tested with bash, so you could get unexpected
> breakage.


Im not guessing

> But it's your system. You can do what you want.


Thats true - and anyone is free to read the manual pages and user guides
on bash to understand that there is not now, nor can there ever be, any
'unexpected breakage' to result from my 'fix'.
>
>>2.I moved the bash binary to /bin/shells (simply cp /usr/local/bin/bash
>>to the standard shells dir. I kept the original in local though it would
>>not matter if i delete it).

>
> I'm out of touch with a lot of stuff. Where is /bin/shells a standard
> directory? I've never heard of it. Looking at the FreeBSD 7.0 and
> Solaris windows I have within reach, I don't see it on either machine.


LOL
Reply With Quote
  #13  
Old 08-28-2008, 12:32 PM
Default Re: cant you set bash as the login shell?

On Thu, 28 Aug 2008 13:14:47 +0000, Lars Eighner wrote:


> There is no such place in the standard heirarchy. This whole
> arrangement seems like a bad idea, especially as there is a ready-made
> bash superuser. However, anyone bound and determined to do it should
> compile bash statically, at the very least.


I have NOT invented some new directory. I was obviously referring to the
standard dir that contained reference to several shells but not bash. The
poster above knows full well what I meant and that the directory i stated
was an obvious typing mistake.

But I am interested to know why you write that static compilation of bash
would make any difference at all?
Reply With Quote
  #14  
Old 08-28-2008, 12:33 PM
Default Re: cant you set bash as the login shell?

Begin <48b6d122$1_2@mk-nntp-2.news.uk.tiscali.com>
On 28 Aug 2008 17:24:02 +0100, NVangogh wrote:
^^^^^^^^^^^^^^

As a sidenote:

It'd be nice if you would use either a domain you actually own or have
permission from the owner to use, or use something that isn't a saleable
domain. Changing .net to or simply appending .invalid would do nicely.

Yes, that domain is squatted and so on. Still no reason to do the same.


> On Thu, 28 Aug 2008 12:49:32 +0000, Drew Lawson wrote:
>> But it's your system. You can do what you want.

>
> Thats true - and anyone is free to read the manual pages and user guides
> on bash to understand that there is not now, nor can there ever be, any
> 'unexpected breakage' to result from my 'fix'.


Your faith in the benevolent goodness of gnu is touching.

Plenty of people here have distinctly different experiences.


--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.
Reply With Quote
  #15  
Old 08-28-2008, 12:33 PM
Default Re: cant you set bash as the login shell?

On Thu, 28 Aug 2008 13:35:56 +0000, Drew Lawson wrote:


> Section 3.9.1
> http://www.freebsd.org/doc/en_US.ISO...ok/shells.html
>
> Cleverly hidden under: UNIX Basics / Shells.


Thanks - I will take a look at this.
Reply With Quote
  #16  
Old 08-28-2008, 01:18 PM
Default Re: cant you set bash as the login shell?

In article <48b6d122$1_2@mk-nntp-2.news.uk.tiscali.com>
NVangogh writes:
>On Thu, 28 Aug 2008 12:49:32 +0000, Drew Lawson wrote:
>
>> Lots of people do, but what you have done is way more than change your
>> login shell. You've changed what /bin/sh is for every shell script run
>> by any user (real or deamon) on that system.

>
>> I'm guessing many of those
>> scripts will not have been tested with bash, so you could get unexpected
>> breakage.

>
>Im not guessing


You mean that you have tested all of the FreeBSD Bourne shell scripts
and confirmed that they work correctly in bash? All of them?
Periodic? Make subshells? Ports? All the other subpieces that
I'm not aware of?

I find it hard to believe that you've exercised the system that
fully and still didn't have enough familiarity to edit /etc/shells.

None of this is saying that bash is broken or lesser. I don't use
it, but I was under the impression that there are bits and pieces
that are intentionally different than sh. Any one of those could
affect how a script that you don't know about runs.

--
Drew Lawson

I only came in search of answers, never planned to sell my soul
I only came in search of something left that I could call my own
Reply With Quote
  #17  
Old 08-28-2008, 02:30 PM
Default Re: cant you set bash as the login shell?

NVangogh wrote:

> I have NOT invented some new directory. I was obviously referring to the
> standard dir that contained reference to several shells but not bash.


There is no such directory, whatever the name is. The thing
that determins a shell to be standard shell on a particular system is
the file /etc/shells. All permitted shells are listed there, and that
file is where system tools look to learn if a user's shell is valid.

Regards

Christoph Weber-Fahr
Reply With Quote
  #18  
Old 08-28-2008, 03:27 PM
Default Re: cant you set bash as the login shell?

On 28 Aug 2008 13:19:15 GMT, jpd wrote:
> Begin <48b5eb74$1_2@mk-nntp-2.news.uk.tiscali.com>
> On 28 Aug 2008 01:04:04 +0100, NVangogh wrote:
> [snip!]
>> ...it returned a few instances of ^ but not relating to piping. The way
>> was clear for me to install bash and banish sh.

>
> Why you'd want to ``banish sh'' is unclear to me. The system needs sh,
> and as you say you only want to use bash as your login shell (and I
> sincerely hope your normal login name is not ``root'').


I really don't get it. I have been reading this thread, and all the
'weird' things done in the name of using bash, and I honestly think it
is all a very nice exercise in breaking a perfectly working system.

tcsh has a nice history mechanism, and once you have logged in as root,
typed exactly *once* the command:

tcsh# exec env SHELL=/usr/local/bin/bash bash -l

It is _trivial_ to rerun this after each root login, by typing

tcsh# exec

and hitting the UP arrow.

``banishing sh'' just for the sake of being able to say ``Look, I have a
completely non-standard shell, which can break whenever I accidentally
update the gettext or the libiconv port and forget to update my stale
shell copy in /bin/shells'' is, IMHO:

* Begging for trouble, and a problem waiting to happen

* Useless, since it's so easy to run bash anyway

Pfeh... that's all I'm going to say :P

Reply With Quote
  #19  
Old 08-28-2008, 04:01 PM
Default Re: cant you set bash as the login shell?

In our last episode, <48b6d309$1_4@mk-nntp-2.news.uk.tiscali.com>, the
lovely and talented NVangogh broadcast on comp.unix.bsd.freebsd.misc:

> On Thu, 28 Aug 2008 13:14:47 +0000, Lars Eighner wrote:



>> There is no such place in the standard heirarchy. This whole
>> arrangement seems like a bad idea, especially as there is a ready-made
>> bash superuser. However, anyone bound and determined to do it should
>> compile bash statically, at the very least.


> I have NOT invented some new directory. I was obviously referring to the
> standard dir that contained reference to several shells but not bash. The
> poster above knows full well what I meant and that the directory i stated
> was an obvious typing mistake.


That is absurd.

> But I am interested to know why you write that static compilation of bash
> would make any difference at all?


Because when you boot as a single user, bash may not be able to reach
dynamically linked libraries.

The fact that you don't know the reasons, does not mean there aren't any.

--
Lars Eighner SAVE BEASTIE! "What do you do when you're debranded?"
usenet@larseighner.com http://larseighner.com/
TIP: At BASH prompt enter Ctrl-v to see what string (most) keys send
Reply With Quote
  #20  
Old 08-28-2008, 04:55 PM
Default Re: cant you set bash as the login shell?

On Thu, 28 Aug 2008 22:27:42 +0300, Giorgos Keramidas wrote:
>On 28 Aug 2008 13:19:15 GMT, jpd wrote:
>> Begin <48b5eb74$1_2@mk-nntp-2.news.uk.tiscali.com>
>> On 28 Aug 2008 01:04:04 +0100, NVangogh wrote:
>> [snip!]
>>> ...it returned a few instances of ^ but not relating to piping. The way
>>> was clear for me to install bash and banish sh.

>>
>> Why you'd want to ``banish sh'' is unclear to me. The system needs sh,
>> and as you say you only want to use bash as your login shell (and I
>> sincerely hope your normal login name is not ``root'').

>
> I really don't get it. [snip]


I should have written "I really don't get it _either_." This would be a
more clear way of showing that I _agree_ with what jpd wrote, including
the tip about *not* logging in as root all the time.

Here's my laptop's ac(8) output, for example:

% ac -p
keramida 522.95
root 0.31
total 523.26
%

Let's just say that if you are using the `root' account so much that it
is a burden to type `bash' at the tcsh prompt, then as jpd hinted at,
you are doing something *very* wrong and not having bash as your login
shell is the last of your troubles.

Reply With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 12:16 AM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger