Difference between Shell at console and GUI, please explain

I’ve been using Freenas and now Truenas Scale for some time, however due to circumstances I had to change hardware and move the unit to a more remote location in my home. So now, it would be used headless. One thing I like to use was the Shell in Linux (Option 7) to check on things, especially smart tests, which works fine when physically at the console. However, I can NOT get the usual commands to run in the GUI. This is probably some simple fix, but I cannot find anything in the documentation or online (probably because to avid Linux users it’s obvious… not me). I’ve set the admin user to default to the Shell Truenas Console. I notice there are differences in the prompt between them, which is likely the issue:

  1. Physically at the console the prompt is root@MYNAS2024[/]#
  2. In GUI the prompt is admin@MYNAS2024[/]$
    Do I need to do something else?

At the console you’re logged in as root; through the web GUI you’re logged in as admin. The much better answer would be to pretend the web shell doesn’t exist and SSH to the server (as root or whatever other user you like). But when you’re the admin user and need to run commands as root, prefix them with sudo, e.g., sudo smartctl -t long /dev/sda.

I suspected something simple like this. Thanks!

Depending on how well you set up your environment (-e.g. shell, user, etc) you can do several things to help you administer your system. As an example of a simple setting you can implement, reference a bit of good programming which helped one admin.
Good programming is good programming.

My setup is barely different because I use a different shell than Bash (so my syntax is slightly different). The below works for ZSH and is in my .zshrc file.

alias damn='sudo $(history -n -1)'
1 Like

Clever, but I’d think damnit would make more sense. Of course, sudo !! has the same effect.

Possibly (okay, sure) but the spirit of “the program” (aka: shortcut) was to reduce keystrokes. Feel free to use your own replacement.

You can make it a single character alias, and then when you accidentally type it, spin the wheel of privilege escalation. :slight_smile:

2 Likes

I hate prefixing every command with sudo with a vengeance.

Which does not mean I want to promote logging in as root via SSH or when it is not strictly necessary. Far from it.

But in the way I think and do my “system admin stuff” I prefer to switch context only once. And then I am perfectly aware I am working from a root shell in this session.

  1. login as regular user
  2. sudo su -
  3. do root things
  4. log out
1 Like

Now we’re talking! …damn! is there an ‘undo’?!

I hate sudo too.

I do something similar too. Makes life easier. I change my prompt to have some red in it or a “R” or something like that for a visual clue. But that stuff depends on the shell I’m using too.

I normally use ZSH but have been exploring CSH lately, for example.

EDIT:
I always have: alias su='su -m' in my rc file. and then I do the dancing with my prompt somehow (I’d have to find it).