-
Notifications
You must be signed in to change notification settings - Fork 0
How to add new user and remote root login
Daisho Komiyama edited this page Jul 27, 2020
·
7 revisions
Leaving root user login available isn't good practice when it comes to server setup. Today I'm going to walk through how to add new user then remove root user login.
- First, login to your server using root
- Then update your server
apt update
thenapt upgrade
(upgrade might take a few minutes)
adduser daisho
- Enter new UNIX password (you can skip this if you are going to set up ssh key)
- You can leave blank the rest: entering user information
su daisho
-
cat /var/log/auth.log
you will get permission denied
-
sudo cat /var/log/auth.log
this should be successful
-
Go to home directory:
cd ~
-
Create
.ssh
directory:mkdir -p ~/.ssh
-
Create authrized_keys file and paste PUBLIC key (generated in your local machine)
-
If you have multiple public keys, just paste them in the same file on new line