I connect via ssh to multiple Linux servers during the day from my Mac's Terminal window.
On my Mac I have the public and private keys in my .ssh directory.
On the Linux servers I always use "sudo su" after logging in to do what I need.
Right now I have my public key in the .ssh directory of my home directory on Linux, in the authorized_keys file. That way I can login without sending a password.
But I notice, since I have su access, that I could create an authorized_keys file in the .ssh directory inside ~root. Then to access I could ssh as root instead of my username.
The advantage is just that I wouldn't have to do sudo su after logging in, thus saving a step.
The disadvantage is that if everybody with su access did this we wouldn't know who was logged in at any time via the users command. It would always just show root.
It seems "too easy" to be able to add my public key to the ~root/.ssh directory though.
What is considered best practice in this case? Is it "better" in general to login with my own account and then do sudo su as needed?
Note I'm not asking whether it is safe to ssh in as root or not, which has been discussed elsewhere. Since I'm doing "sudo su" anyway, I'm always becoming root, and the handful of users with accounts on these machines can all do that, and need to do that to accomplish their tasks.
What I do all the time is (1) login; (2) sudo su; (3) cd to a certain directory; (4) do what needs to be done and exit. I do this dozens of times a day on multiple servers.
So what I'm curious about is for people in my situation is whether there is an advantage to doing it that way rather than going in directly as root and saving a bit of time.
Thanks,
doug