I have a server running Debian, which is on the web, and has few traffic (I use it essentially for some coulds, calendars, etc. for me). In an attempt to secure its access, I made the following in the ssh configuration:
- log-in with SSH-Keys only,
- no root log-in allowed.
Then I log in as my main (and essentially only) user, and use
su to switch to
root when administrative operations are necessary.
Browsing around the site, I gathered that
sudo rights to the user is a preferred option. But the main common argument for it, is when sharing administrative rights. Which is not an issue for me. I can see the following
sudo: two passwords required: the ssh-key to get in as a user and then the root password. So some form of double protection.
sudois set with
NOPASSWDthen no password is transmitted over the internet, and whatsmore no password is entered, defeating the keyloggers.
- Direct SSH-Key to
root: facilitate remote backup, auditing, etc. But seems less secure as root username is known and a single password (ssh-key) is required.
What is the most secure way to get to do administrative tasks on my own server?
Should I assume that SSH-Keys protection leave me only to choose between ssh-key theft or keylogging? And what is the most common of those? If that's relevant, I only connect to it either directly from my home computer or, from my mobile phone via another server (so that the ssh-key isn't stored on my phone).