Not sure what I'm doing wrong here.
User2 sources a file in it's .bash_profile to set environment specific aliases.
# .bash_profile source $HOME/set_environment_shortcuts
Inside $HOME/set_environment_shortcuts (there are many aliases in here). Example:
Now I would like to 'startservices from another user.
[User1@server1 ~]$ sudo su -l User2 -c '. ~/.bash_profile; startservices' -bash: startservices: command not found
The runuser command produces the same result.
[User1@Server1 ~]$ sudo runuser -l User2 -c '. ~/.bash_profile; startservices' -bash: startservices: command not found
Do aliases not work in this way?
Note, when bypassing the alias entirely, the command works.