Home
PHP
Tech Tube
MySQL
Linux
CSS&HTML
JavaScript

Interesting Linux SSH cases

Oh My ZSH: A few days ago I've had a SSH connection issue to my PC after I uninstalled "Oh My ZSH". I've checked the logs during the login attempts and the obvious reason was the ZSH.
tail -f /var/log/auth.log

Jan  6 13:17:18 samuil-pc sshd[19006]: User samuil not allowed because shell /usr/bin/zsh does not exist
Jan  6 13:17:18 samuil-pc sshd[19006]: input_userauth_request: invalid user samuil [preauth]
Jan  6 13:17:40 samuil-pc sshd[19006]: Connection closed by 192.168.2.151 port 45549 [preauth]
So I've changed the login shell and everything was fine again:
sudo chsh -s /bin/bash samuil
Another useful SHH note: To allow SSH access to specific user just edit /etc/ssh/sshd_config adding
Port 1234
PermitRootLogin no
AllowUsers sami
At first you may want to allow the user to login without private key until you set it.
PasswordAuthentication yes
PubkeyAuthentication no
Don't forget to reload the service after editing /etc/ssh/sshd_config
sudo service ssh reload
Avoid typing the SSH key passphrase:
ssh-add ~/.ssh/id_rsa
To list automatically loaded keys:
ssh-add -L
To disable all keys:
ssh-add -D