Shell command issues with non-root-admin

flocki

Cadet
Joined
Dec 18, 2022
Messages
3
Hi,

I have created a new non-root-admin on Bluefin after the latest update.

However while using the shell as this user for example I can't run the "zpool" command, as this will give me the error "zpool: command not found"
When going back to the root-account it works fine.

Any hints how to fix this would be appreciated.

Florian
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
This is basic UNIX. Some of the ZFS commands are not in typical "user" bin directories, and the systemwide profile sets the PATH accordingly because these tools shouldn't be run (and often cannot be run) as a standard user. Take a look here:

Code:
root@truenas[~]# cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$(id -u)" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

[less interesting stuff snipped here to keep us focused]
root@truenas[~]# ls -a
.        .gdbinit  .midcli.hist  .warning       .zshrc  solnet-array-test-v3.sh
..       .lesshst  .profile      .zlogin        q       syslog
.bashrc  .local    .ssh          .zsh-histfile  samba   tdb
root@truenas[~]#



So, two different things may be happening to you. One, if you ARE using a shell which sources /etc/profile, but you have a UNIX user-ID that isn't zero, the "sbin" subdirectories are not included. I would argue this is actually correct. Two, if you are using a different shell such as csh, there may not be ANY dotfiles to set up PATH.

Now, I cannot give any particular advice here because I am not entirely certain how iXsystems intends "non-root" accounts to work, and I'm also not real big on the whole Linux thing. Some things such as traceroute and zpool are administrator-oriented tools that nevertheless work for end users. In such a case, I would suggest creating dotfiles suitable to your use case.
 

flocki

Cadet
Joined
Dec 18, 2022
Messages
3
In both zsh (default for root) and bash (which I tend to use) PATH are set, but don't include /usr/sbin (indicating the script applies "as intended").

Creating a dotfile however is no solution, since there exists no home-directory (where I would need to put this), as I can't put this on the boot-pool and don't want to have it on the productive pool.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
don't want to have it on the productive pool.

That's basically a self-inflicted wound, though. So I have to disagree with

Creating a dotfile however is no solution, since there exists no home-directory

It's easy to create a home directory, which in turn allows you to have dotfiles. Your choosing not to configure that is a choice, not a failure for a solution to exist.

The policy for home directories has generally been for them to live on the production pool, because the contents of the boot pool are deemed transient and can be replaced at any time. This has meant that user accounts need to be stored elsewhere and not on the boot pool. I think you might be out of luck here. You might see if you can get them to modify the contents of /etc/profile, but unnecessary deviations from the baseline OS are usually rejected.
 
Top