[Solved] Displaying console menu in ssh connection for non-root admins

Started by errored out, September 17, 2020, 04:39:09 AM

Previous topic - Next topic
Your profile script looks a little different from mine. I am wondering if there is a syntax error.
When you login, what happens if you type sh .profile

My .profile script looks like this:
# $FreeBSD$
#
HOME=/root
export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
TERM=${TERM:-xterm}
export TERM
PAGER=less
export PAGER

# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV

# Query terminal size; useful for serial lines.
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi

# Uncomment to display a random cookie on each login.
# if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune -s ; fi
sudo opnsense-shell

Once I log in I get:
login as: coden
Keyboard-interactive authentication prompts from server:
| Password:
End of keyboard-interactive prompts from server
Last login: Tue May 17 08:44:12 2022 from 192.168.0.13
----------------------------------------------
|      Hello, this is OPNsense 22.1          |         @@@@@@@@@@@@@@@
|                                            |        @@@@         @@@@
| Website:      https://opnsense.org/        |         @@@\\\   ///@@@
| Handbook:     https://docs.opnsense.org/   |       ))))))))   ((((((((
| Forums:       https://forum.opnsense.org/  |         @@@///   \\\@@@
| Code:         https://github.com/opnsense  |        @@@@         @@@@
| Twitter:      https://twitter.com/opnsense |         @@@@@@@@@@@@@@@
----------------------------------------------
coden@hush:~ %


and type sh. profile I get
coden@hush:~ % sh .profile

*** hush.local: OPNsense 22.1.7_1 (amd64/OpenSSL) ***

LAN (igc3)      -> v4: 192.168.0.1/24
LAN2 (igc2)     -> v4: 192.168.10.1/24
LAN3 (igc1)     -> v4: 192.168.20.1/24
WAN (pppoe0)    -> v4/PPPoE: x.x.x.x/32

HTTPS: xxxx
SSH:   xxxx (ECDSA)
SSH:   SHA256 xxxx (ED25519)
SSH:   SHA256 xxxx (RSA)

  0) Logout                              7) Ping host
  1) Assign interfaces                   8) Shell
  2) Set interface IP address            9) pfTop
  3) Reset the root password            10) Firewall log
  4) Reset to factory defaults          11) Reload all services
  5) Power off system                   12) Update from console
  6) Reboot system                      13) Restore a backup

Enter an option:

I put some asterisks on purpose.

Which shell is configured for the user? The "%" prompt might mean it's csh - which does not read .profile.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: pmhausen on May 17, 2022, 09:57:16 AM
Which shell is configured for the user? The "%" prompt might mean it's csh - which does not read .profile.
Looking at System: Access: Users the Login shell is on /bin/csh

Other options are:
/sbin/nologin
/bin/sh
/bin/tcsh

So, I changed Login shell to /bin/sh and it works now, many thanks @pmhausen