[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
When using SSH to connect to the FW root account, you get the console menu.  When connecting through an non-root administrator account, the menu is not shown.  Only receive command prompt.

Looking to root and other admin accounts, the console menu is accessible by /usr/local/sbin/opnsense-shell.  This option is only available for the root account.  All other accounts (even admins) do not have the ability to select this as an option. 

How can I access the console menu automatically when logging into an admin account similar as to the root account?

I understand once the admin is logged in the user can sudo into opnsense-shell, but have to remember to do that every-time is not feasible. 

Quote from: errored out on September 17, 2020, 04:39:09 AMbut have to remember to do that every-time is not feasible.

Ok, I don't understand this conclusion but if you must:

Set sudo to enabled without password, add "sudo su" at the end of your ~/.profile


Cheers,
Franco

September 18, 2020, 12:58:33 AM #2 Last Edit: September 18, 2020, 09:56:51 PM by errored out
Thank you, for the help. 




What an awful thread.
This post was at the top of a google search when I had this problem. I was unsure of the best method for login scripts for freebsd so I'll update it with a real answer; add sudo opnsense-shell to the end of your .profile folder for the non root user.
Non root users needs sudo access.

I guess thanks for posting the awful answer again to a solved thread over a year ago? I get the feeling the word "awful" us awfully displaced. ;)


Cheers,
Franco

Hello Franco,
Your reply was not a direct answer and may confuse others with the same problem.
I was able to come to a solution by reading the details of OP's question and learning about the .profile login script from your reply.
I then provided a clear answer for those that stumble into the same thread via google.

Yet "sudo su" is the same as "sudo opnsense-shell", which is why this was marked "Solved".


Cheers,
Franco

And this is why using aliases is bad practice in public discussions. I had thought it was the same function that it does in linux, switch user. I had thought your reply was how to switch to root.

Edit: I do apologize for my misplacement of your reply.

Sure, su switches to root with the configured shell, which is opnsense-shell by default. For daily typing I use this to save time and energy:

# sudo su

or

# sudo csh

Depending on what I want to do on the box that doesn't have direct root access.

That's just where this comes from, but calling sudo opnsense-shell certainly works too.


Cheers,
Franco


login as the user you want to this for, it should take you to your home directory. To check just issue "ls -alh ~/" and it should list a file called ".profile" the leading full stop is relevant.
If you can see it then in your favourite editor ie. nano you edit it:
"nano ~/.profile" . Make your changes, save and exit.
You need to log out and log back in to take effect. No reboots are necessary.

From the user in question...

# echo "sudo su" >> ~/.profile


Cheers,
Franco

Quote from: cookiemonster on May 11, 2022, 10:22:37 PM
login as the user you want to this for, it should take you to your home directory. To check just issue "ls -alh ~/" and it should list a file called ".profile" the leading full stop is relevant.
If you can see it then in your favourite editor ie. nano you edit it:
"nano ~/.profile" . Make your changes, save and exit.
You need to log out and log back in to take effect. No reboots are necessary.
Not sure what I'm doing wrong, but it doesn't work for me, please see attachment. I still have to type sudo su or sudo csh once I log in.

Tia.

If you replace sudo su with sudo opnsense-shell does it fix the problem?