When I was setting up some services for my homelab on my Proxmox machine, I was entering the same commands multiple times. So I wrote them down here to be able to quickly enter them again.
Create user with home directory and bash as shell
sudo useradd -m -s /bin/bash username
Set password of new user
sudo passwd username
Add user to sudo group
sudo usermod -aG sudo username
Enable networking
Edit the file /etc/network/interfaces
and add the contents:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
Then restart the networking service:
sudo service networking restart
Ubuntu 24.04 container
Ubuntu 24.04 uses netplan and the above setup will not work. To get internet to work, use these commands:
sudo nano /etc/netplan/00-installer-config.yaml
Change the contents to:
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp6: false
optional: true
nameservers:
addresses:
- 10.10.10.102
Then apply:
sudo netplan apply