Print ssh and su chain
- by user1824885
Is there a way to show the complete ssh and su chain in bash?
For example. In Server A as user aa:
su - ab
ssh ba@B
su - bb
Thus, I would like a command that prints something like this:
1 bash aa in A
2 su ab in A
3 ssh ba in B
4 su bb in B
I tried pstree but it does not print the users and only works with the processes of the last ssh'ed server:
$ pstree | grep -C 5 pstree
serversshd---sshd---sshd---bash---su---bash-+-grep
| `-pstree
Thanks and regards.