We have a password less authentication between the server for root user, I am trying to run the alias on remote server as below
#ssh remoteserver runuser -l wasadmin wasstart
But it is not working. Any suggestions or any other method to achieve itlinuxbashsshsudo
Based on your comments as you need to sudo to wasadmin in order to run wasadmin, you can try this:
ssh remoteserver 'echo /path/to/wasadmin wasstart | sudo su - wasadmin'
For add an alias in linux you must run
Notice: This will work until you close or exit from current shell . To fix this issue just add this to you .bash_profile and run source .bash_profile Also your profile file name depending on which shell you using . bash , zsh ,...