log in with your root ssh key
local> ssh -i ~/.ssh/root_key_rsa root@46.101.181.30
set a root password
root@remote> passwd
install zsh and vim
root@remote> pkg install zsh
root@remote> pkg install vim-lite
create a new user
root@remote> adduser
Username: johndoe
Full name: John Doe
Uid (Leave empty for default):
Login group [johndoe]:
Login group is johndoe. Invite johndoe into other groups? []: wheel
Login class [default]:
Shell (sh csh tcsh zsh rzsh nologin) [sh]: zsh
Home directory [/home/johndoe]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : johndoe
Password : *****
Full Name : Jon Doe
Uid : 1002
Class :
Groups : johndoe wheel
Home : /home/johndoe
Home Mode :
Shell : /usr/local/bin/zsh
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (johndoe) to the user database.
Add another user? (yes/no): no
Goodbye!
enable group "wheel" for sudo:
root@remote> visudo
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
Transfer another ssh public key to the machine for the new user, move it to the right location and set the user / group accordingly
local> scp -i ~/.ssh/root_key_rsa _~/.ssh/user_key_rsa.pub root@46.101.181.30:johndoe_rsa.pub
root@remote> mkdir /home/johndoe/.ssh
root@remote> mv ~/johndoe_rsa.pub /home/johndoe/.ssh/authorized_keys
root@remote> chown -R johndoe /home/johndoe/.ssh
Try to log in as new user on remote machine (and configure zsh)
local> ssh -i ~/.ssh/user_key_rsa johndoe@46.101.181.30
Since there is now a user with sudo privileges, we don't need to login as root anymore. Every other config should be done with the new user and sudo:
local> ssh johndoe@46.101.181.30