Connection & user
To install a new server, you have to choose a provider. I use Hetzner VPS with Debian 12. Of course you can use any other provider and any other OS.
INFO
When I offer to create new user, I call it jack
, you can use any other username.
Connect to server
If it's setup of server, you have to disable ssh with root and allow it with a custom user.
ssh root@xxx.xx.xx.xxx
Get IP address from server
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
Add sudo (Debian)
If sudo
is not installed, you have to install it. To execute this, you have to be connected with root
.
su - root
apt install -y sudo
After that, you can add new user and add it to sudo
group.
adduser jack
usermod -aG sudo jack
Now you can exit SSH session and connect with new user.
INFO
You have to kill current session with exit
command to reload groups.
exit
You can now connect with new user and use sudo
command.
Add new user
Add new user (you can use any other name)
sudo adduser jack
sudo usermod -aG sudo jack
Exit SSH connection to reload groups
exit
Fix locales
Fix locales for new user
sudo vim /etc/default/locale
LC_CTYPE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"
Generate locales
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
dpkg-reconfigure locales
Copy SSH keys from root
Copy SSH keys from root to new user
sudo mkdir /home/jack/.ssh/
sudo cp /root/.ssh/authorized_keys /home/jack/.ssh/
sudo chown -R jack:jack /home/jack/.ssh/
sudo chmod -R 700 /home/jack/.ssh/
Exit SSH connection
exit
Connect with new user
Connect to server with new user
ssh jack@xxx.xx.xx.xxx
Than now you can reboot server
sudo reboot
Change root password
sudo -i
passwd
exit