Table of Contents
Cài SSH Server và fix lỗi SSH Permission denied, please try again.
Cài SSH Client và SSH Server
Cài SSH Client
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-client
Cài SSH Server
sudo apt-get update
sudo apt-get upgrade
sudo apt install openssh-server
Start SSH Server
Theo hướng dẫn của người ta thì là vầy
- Open your terminal application
- Install the openssh-server package on Ubuntu, run:
**sudo apt install openssh-server**
- Enable ssh server on Ubuntu, run:
**sudo systemctl enable ssh**
- By default, firewall will block ssh access. Therefore, you must enable ufw and open ssh port
- Open ssh tcp port 22 using ufw firewall, run:
**sudo ufw allow ssh**
- Congratulations. Now you have SSH server installed and running on your Ubuntu server. You can connect to it using ssh client.
Tuy nhiên mình cài cho
Ubuntu Docker
thì không được, nhưng mình làm như sau thì được :')
cd /etc/init.d/
./ssh start
# Hoặc
sudo service ssh start
Fix lỗi SSH Permission denied, please try again.
Lúc mình cài xong SSH Server
, mở port ra thì bị đăng nhập không được với tài khoản root
, mò một hồi thì sau đây là cách fix lỗi SSH Permission denied, please try again
# Ubuntu 16.x
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# Ubuntu > 18.04
sed -i 's/#\?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
Tham khảo
- https://www.cyberciti.biz/faq/how-to-install-ssh-on-ubuntu-linux-using-apt-get/
- https://askubuntu.com/questions/707621/official-docker-image-for-ubuntu-server
- https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc/
- https://stackoverflow.com/questions/60833261/cant-ssh-to-dockerubuntu19-04-because-of-happen-permission-denied
- https://superuser.com/questions/1562492/cant-ssh-into-docker-container