I am trying to write a script in server1 which will be executed using user1 to execute some commands in server2 with user2
So in server1 if I try to execute the below command using user1, I am not able to see the environment variables of user2 (which is defined in /home/user2/.profile)
ssh user2@server2 "env"
Due to this I am not able to execute the user2 specific commands from server1 using ssh.
Note : proper ssh is configured between server1/user1 and server2/user2, and I can view the processes running in server2 from server1 if I give
ssh user2@server2 "ps -ef|grep user2"