Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2012 20:06:30 GMT
From:      Toomas <toomasp@gmx.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/167073: rbash as login shell not working as expected
Message-ID:  <201204182006.q3IK6UH1038778@red.freebsd.org>
Resent-Message-ID: <201204182010.q3IKA25P016099@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167073
>Category:       ports
>Synopsis:       rbash as login shell not working as expected
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 18 20:10:01 UTC 2012
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204182006.q3IK6UH1038778>