Setting up linux server for ionos

From Logic Wiki
Revision as of 12:31, 14 December 2024 by AliIybar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Creating a new user

Go to terminal/command prompt/powershell and connect to server with the given ip and root user / password by entering this

ssh root@1.2.3.4 

it will ask you some questions and your password. Say yes and enter your password provided by ionos and after logging in enter this command to add a new user

sudo adduser <newuser>

Giving sudo priviliges

Adding the New User to the Sudo Group

groups <newuser>
sudo usermod -aG sudo <newuser>

Or run visudo

sudo visudo

and add this under root

root    ALL=(ALL:ALL) ALL
<newuser> ALL=(ALL:ALL) ALL

Testing Connection

ssh <newuser>@1.2.3.4 

you should be in the server after entering the password.

enter exit to quit ssh

exit

Setting SSH

  • Go to terminal/command prompt/powershell
  • Create ssl keys if you haven't done already

Mac / Linux :

 ssh-keygen -t rsa

do not enter passphrase. Leave it blank it creates the key pairs under your user in .ssh folder

id_rsa
id_rsa.pub

Copy local key to remote

ssh-copy-id user@ip_address

if .ssh folder has not enough rights

chmod -R go= -/.ssh

Some special files in .ssh folder

config

it's a kind of alias file for the servers

  Host MyServer
    HostName 1.2.3.4
    User myuser

  Host UbuntuServer
    HostName 192.168.1.203
    User ali

after defining this you can use ssh like

ssh MyServer

known_hosts

Remote pub keys to make handshake smooth without passwords

192.168.1.203 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFFUPP/Dpo44K3v+tQiIi9+4KezGSA8VPaI8gPBBQUsQ
80.165.196.189 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBpKbDBqwWuS1HAN+DnnTDrHWaHQXbPdna/pfvRRbRew