First we need to create the user before we create the ssh folder and the file authorized_keys
Step one user creation
Add user:
sudo useradd theusername
add user to the wheel group ( -a = append G is group wheel is the group to add the user to! )
sudo usermod -aG wheel theusername
Set password for user theusername
sudo passwd theusername
Test the sudo for the user theusername
sudo ls -la /root
Step two create the .ssh folder and authorized_keys and set permissions
create .ssh folder
mkdir ~/.ssh
cretate the file authorized_keys
touch authorized_keys
change permissions on ssh folder
chmod 700 ~/.ssh
change permission on file authorized_keys
chmod 600 ~/.ssh/authorized_keys
restore SELinux settings on ~/.ssh
restorecon -Rv ~/.ssh
Step three copy the ssh_key to server
open ~/.ssh/authorized_keys and add your public key
vi ~/.ssh/authorized_keys