ports/167073: rbash as login shell not working as expected

Toomas toomasp at gmx.net
Wed Apr 18 20:10:02 UTC 2012


>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 at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

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

rm: "." and ".." may not be removed
[root at aurelia ~]# echo "PATH=/nowhere" > /home/rbasher/.profile
[root at aurelia ~]# su - rbasher
[rbasher at 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 at aurelia ~]$ ls -al
-su: ls: command not found

[rbasher at aurelia ~]$ export PATH="/bin/:/usr/bin/"
[rbasher at 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 at 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 at aurelia ~]$ grep rbasher /etc/passwd 
rbasher:*:12345:12345:User &:/home/rbasher:/usr/local/bin/rbash
[rbasher at aurelia ~]$ /usr/local/bin/rbash
[rbasher at 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 at aurelia ~]$ export PATH="/blah"     
rbash: PATH: readonly variable
[rbasher at aurelia ~]$ exit
exit
[rbasher at 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:



More information about the freebsd-ports-bugs mailing list