NOTE: Do not remove anything other then the key from the file noted below at first.
Do not remove root password or root from sudoers until you are sure the new account can access everything through sudo.
Log into the server with your root account. (Guessing this isn't Ubuntu on the server)
Create a new user on the server and make sure they have sudo privileges. The Ubuntu way https://help.ubuntu.com/community/Sudoers, but since root is available on the server I am guessing it is not Ubuntu on there. Ask for further information if not clear on this.
User privilege specification
root ALL=(ALL) ALL
newUSER ALL=(ALL) ALL
Log out of the server.
ssh into the server again this time into the new account
- Test sudo with your your new account on the server with something
sudo apt-get update <<<<- If this lets you run the sudo command without complaining about not being in sudoers file/sudo group you have a working sudo account.
- nano or vim or use your favorite terminal editor to remove the keys from this file home/YOURUSERNAME/.ssh/authorized_keys
- This file may be located elsewhere on other distributions, so either "find" or "locate" authorized_keys if not in above noted location. Since you are doing this to the file of the root account you will have to use "sudo locate" or "sudo find" for it to search root owned directories.
7.Log out again and copy your key to the new user.
Login using key and disable root login in /etc/ssh/sshd_config
9.requiers See if any application or service breaks because root doesn't have ssh access.
If 9 doesn't break it you can disable root account entirely
sudo passwd -l root
This will give the account an impossible to use password which makes it unusable until a new password is set. (requires sudo so test and test and test before removing anything.)
Excuse the formatting I'm new here and it's past my bed time.