You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When script s started with sudo, whoami returns root instead of the username of calling user. Replace with logname for the last two lines to work correctly.
The text was updated successfully, but these errors were encountered:
Yes, this does work. But you can simply replace $(whoami) with $(logname) to achieve the desired effect. You can test that by running following commands
sudo sh -c 'echo $(whoami)' - that will return root
sudo sh -c 'echo $(logname)' - that will return the correct username
When script s started with sudo, whoami returns root instead of the username of calling user. Replace with logname for the last two lines to work correctly.
The text was updated successfully, but these errors were encountered: