0

as simple user, first I pass root with command :

su

I am now root on Debian 10 buster.

When I hit ufw status, I have 'command not found'. But it works with sudo ufw status

When I use su -, the command is ok.

Can someone explain me this problem / this difference between su and su - and why the command is not found even if I am root in the first case ?

rach
  • 1

1 Answers1

0

Simple answer is with - you can export path env variables etc. but not with only su, Kindly refer this page.

   -, -l, --login
       Start the shell as a login shell with an environment similar
       to a real login:

       •   clears all the environment variables except TERM and
           variables specified by --whitelist-environment

       •   initializes the environment variables HOME, SHELL, USER,
           LOGNAME, and PATH

       •   changes to the target user’s home directory

       •   sets argv[0] of the shell to '-' in order to make the
           shell a login shell
asktyagi
  • 2,860
  • 2
  • 8
  • 25