I am confused about the difference between running a command as "user1" in a terminal and running a command as "sudo -Hiu user1 [command]".
If I run
/home/user1/script.sh
, the script successfully calls a program that accesses GNOME/Keyring and the program gets the password without any issues.
However, if I run sudo -Hiu user1 /home/user1/script.sh, the program the script calls fails to access GNOME/Keyring successfully.
What is the difference between executing commands as user1 and running sudo -Hiu user1 [command] and how can I fully change users from e.g. root to user1 in bash?