From nobody@FreeBSD.org  Wed Apr 18 20:06:31 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CB19106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 18 Apr 2012 20:06:31 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F7118FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 18 Apr 2012 20:06:31 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q3IK6Ur9038779
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 18 Apr 2012 20:06:30 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q3IK6UH1038778;
	Wed, 18 Apr 2012 20:06:30 GMT
	(envelope-from nobody)
Message-Id: <201204182006.q3IK6UH1038778@red.freebsd.org>
Date: Wed, 18 Apr 2012 20:06:30 GMT
From: Toomas <toomasp@gmx.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: rbash as login shell not working as expected
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         167073
>Category:       ports
>Synopsis:       shells/bash: rbash as login shell not working as expected
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 18 20:10:01 UTC 2012
>Closed-Date:    Fri Sep 28 23:30:42 UTC 2012
>Last-Modified:  Fri Sep 28 23:30:42 UTC 2012
>Originator:     Toomas
>Release:        9.0-RELEASE
>Organization:
>Environment:
FreeBSD aurelia.lan 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
[root@aurelia ~]# pw useradd -n rbasher -u 12345 -m -s /usr/local/bin/rbash 
[root@aurelia ~]# chown -Rh root:wheel /home/rbasher/
[root@aurelia ~]# rm -f /home/rbasher/.*

rm: "." and ".." may not be removed
[root@aurelia ~]# echo "PATH=/nowhere" > /home/rbasher/.profile
[root@aurelia ~]# su - rbasher
[rbasher@aurelia ~]$ export
declare -x BLOCKSIZE="K"
declare -x FTP_PASSIVE_MODE="YES"
declare -x HOME="/home/rbasher"
declare -x MAIL="/var/mail/rbasher"
declare -x OLDPWD
declare -x PATH="/nowhere"
declare -x PWD="/home/rbasher"
declare -x SHELL="/usr/local/bin/rbash"
declare -x SHLVL="1"
declare -x TERM="xterm"
declare -x USER="rbasher"
[rbasher@aurelia ~]$ ls -al
-su: ls: command not found

[rbasher@aurelia ~]$ export PATH="/bin/:/usr/bin/"
[rbasher@aurelia ~]$ ls -la          
total 12
drwxr-xr-x  2 root  wheel  512 Apr 18 21:57 .
drwxr-xr-x  5 root  wheel  512 Apr 18 21:56 ..
-rw-r--r--  1 root  wheel   14 Apr 18 21:57 .profile

[rbasher@aurelia ~]$ ls -al /usr/local/bin/{rbash,bash}
-rwxr-xr-x  1 root  wheel  787216 Apr 17 22:43 /usr/local/bin/bash
lrwxr-xr-x  1 root  wheel       4 Apr 17 22:43 /usr/local/bin/rbash -> bash
[rbasher@aurelia ~]$ grep rbasher /etc/passwd 
rbasher:*:12345:12345:User &:/home/rbasher:/usr/local/bin/rbash
[rbasher@aurelia ~]$ /usr/local/bin/rbash
[rbasher@aurelia ~]$ export
declare -x BLOCKSIZE="K"
declare -x FTP_PASSIVE_MODE="YES"
declare -x HOME="/home/rbasher"
declare -x MAIL="/var/mail/rbasher"
declare -x OLDPWD
declare -rx PATH="/bin/:/usr/bin/"
declare -x PWD="/home/rbasher"
declare -rx SHELL="/usr/local/bin/rbash"
declare -x SHLVL="2"
declare -x TERM="xterm"
declare -x USER="rbasher"
declare -x _="/usr/local/bin/rbash"
[rbasher@aurelia ~]$ export PATH="/blah"     
rbash: PATH: readonly variable
[rbasher@aurelia ~]$ exit
exit
[rbasher@aurelia ~]$ /usr/local/bin/bash --version
GNU bash, version 4.2.20(0)-release (amd64-portbld-freebsd9.0)

If the shell is already /usr/local/bin/rbash on the first invocation - then why aren't the environment variables locked as it says on bash man page?

There's also http://www.freebsd.org/cgi/query-pr.cgi?pr=104040 - did rbash work as login shell back then?
>How-To-Repeat:
See the instructions above
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->obrien 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Apr 21 05:43:30 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167073 
State-Changed-From-To: open->feedback 
State-Changed-By: obrien 
State-Changed-When: Mon Apr 30 22:03:21 UTC 2012 
State-Changed-Why:  
I'm not really going to be able to debug this from your environment 
and I don't use rbash.  Please investigate further with Google 
and make sure you're configuring your system as "rbash" expects. 
Otherwise, I believe this is a non-FreeBSD-specific Bash issue. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167073 
State-Changed-From-To: feedback->closed 
State-Changed-By: obrien 
State-Changed-When: Fri Sep 28 23:30:27 UTC 2012 
State-Changed-Why:  
Unable to triage problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=167073 
>Unformatted:
