Bug 706147

Summary: /etc/shells should contain dash
Product: Red Hat Enterprise Linux 6 Reporter: Petr Šabata <psabata>
Component: dashAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: hafflys, huzaifas, maxim, mhradile, ovasik, ppisar, psabata
Target Milestone: rcKeywords: EasyFix, Patch
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: dash-0.5.5.1-4.el6 Doc Type: Bug Fix
Doc Text:
Cause: User with /bin/dash log-in shell tries to log in. Consequence: Use cannot log in because /bin/dash is not allowed log-in shell. Fix: When installing or upgrading dash package, /bin/dash is added into list of allowed log-in shells (/etc/shells). When uninstalling the package, the shell is removed from the from list. Result: Users with /bin/dash log-in shell can log into the system.
Story Points: ---
Clone Of: 706138 Environment:
Last Closed: 2012-10-17 07:26:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 706138    
Bug Blocks: 836169    

Description Petr Šabata 2011-05-19 15:50:39 UTC
+++ This bug was initially created as a clone of Bug #706138 +++

Description of problem:
Users can't use dash as their shell since it's not present in the /etc/shells file.

Version-Release number of selected component (if applicable):
0.5.6-3

How reproducible:
Always.

Steps to Reproduce:
1. Install dash.
2. Try to set dash as your shell (e.g. via chsh)
  
Actual results:
chsh: "/bin/dash" is not listed in /etc/shells.

Expected results:
Shell changed.

Additional info:
This can be solved via %post and %postun scriptlets.

--- Additional comment from psabata on 2011-05-19 17:30:06 CEST ---

%post
if [ $1 -eq 1 ]; then
    grep -qF /bin/dash /etc/shells || echo '/bin/dash' >> /etc/shells
fi

%postun
if [ $1 -eq 0 ]; then
    sed -i '/\/bin\/dash/d' /etc/shells
fi

Comment 1 Petr Šabata 2011-05-19 15:52:08 UTC
Fixed in Fedora already (0.5.6-4 in f15+, 0.5.6-3 in f14).

Comment 5 Stephen Haffly 2011-11-14 03:20:57 UTC
Possibly in fixing this problem another was introduced.

I just upgraded from Fedora 15 to Fedora 16 using preupgrade. I went to start a VirtualBox session, and it complained that it could not do so. This was the error message:

ExtPackInst ExtPack: enmReason=1 iStatus=127 stderr='The value for the SHELL variable was not found the /etc/shells file

I looked at the /etc/shells file and found that /bin/bash was missing. However, /bin/dash was in the file twice.

Once I changed the first instance to /bin/bash, VirtualBox behaved fine. Please check the file as I am sure that it may be causing problems to others. I had not previously had any problem with this, so it had to have come in with the F16 upgrade.

Comment 6 Petr Šabata 2011-11-14 08:56:38 UTC
Stephen,

this is not a Fedora bug, I suppose you wanted to comment on 706138.

Anyway, /bin/dash was added to /etc/shells in F14 and doesn't touch /bin/bash record (or any other) at all.  All that is handled in dash %post and %postun scriptlets.

I also don't have /etc/bash in /etc/shells but I have /etc/dash there just once.

The file belongs to the 'setup' package.  Please, file a bug report with it.

What is also weird is bash users can login into the system although the record is missing...

Comment 7 Ondrej Vasik 2011-11-14 13:28:05 UTC
Default /etc/shells from setup contains just:
/bin/sh
/bin/bash
/sbin/nologin

The rest of the shells is added by other packages. It would probably make sense to add the additional shells
/bin/tcsh
/bin/csh
/bin/ksh
/bin/zsh
/bin/dash

and maybe others to the default /etc/shells file - as I don't like modifications of default system files by other packages...

Comment 8 Stephen Haffly 2011-11-14 13:36:56 UTC
Thanks. Done. Bug is 753780.

Comment 9 Stephen Haffly 2011-11-14 13:41:08 UTC
Interesting though, the /etc/shells on my netbook contained just 
/sbin/nologin
/bin/dash
/bin/dash

No /bin/sh or any other entry.

The desktop, before I fixed it contained:

/sbin/nologin
/bin/dash
/bin/zsh
/bin/ksh
/bin/dash

I changed the first /bin/dash to /bin/bash. This information was submitted as part of 753780, so I hope to see this fixed quickly.

Comment 10 Petr Šabata 2011-11-15 09:42:02 UTC
Both bash and dash should be fixed (in Fedora) now.

Comment 21 errata-xmlrpc 2012-10-17 07:26:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-1381.html