Basic Linux Commands
May 1st 2023 — basic, command, linux, terminal
SSH Settings
This part is to manipulate ssh settings, see its status etc. Useful if just started a container in Proxmox
First, if SSH is not installed:
sudo apt-get update
sudo apt-get install openssh-server
Then manipulate 'sshd_config' file. If not added add lines below to prevent remote root login, allow remote password logging and set ssh port number(22 by default)
sudo nano /etc/ssh/sshd_config
Port 22
PermitRootLogin no
PasswordAuthentication yes
To see status of SSH, restart or stop it etc use codes below:
sudo systemctl status ssh
sudo systemctl start ssh
sudo systemctl restart ssh
sudo systemctl stop ssh
If ufw is running you may need to make it allow SSH
sudo ufw status
sudo ufw allow ssh
Alternate for not using 'root'
sudo nano /etc/ssh/sshd_config
then add this
PermitRootLogin no
PasswordAuthentication yes
and restart sshd service
sudo systemctl restart sshd
since you are not using root user, creata a user with sudo privileges
sudo adduser <username>
sudo usermod -aG sudo <username>