1. First check if ssh is installed :
Order:
①Check the ssh version: ssh –V
②Check the ssh status: sudo service sshd status
③ Check whether ssh is installed by viewing the installation package: rpm –qa|grep ssh
④If you need to connect SSH remotely, you need to open port 22 on the firewall.
Solution: Turn off the firewall or set an exception on port 22
View port 22: grep port /etc/ssh/sshd_config
⑤ 1. Open port command: /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
2. Save: /etc/rc.d/init.d/iptables save
3. Restart the service: /etc/init .d/iptables restart
4. Check if the port is open: /sbin/iptables -L -n
2. Then install ssh :
①If you are using a series of linux distributions such as redhat, fedora, centos, etc., then type the following command:
sudo yum install sshd
or
sudo yum install openssh-server (provided by osc netizen Huoer)
②If you are using a series of linux distributions such as debian, ubuntu, linux mint, etc., then type the following command:
sudo apt-get install sshd
or
sudo apt-get install openssh-server (provided by osc netizen Huoer)
③ Install ssh through yum: yum install ssh
3. Start the ssh service
/etc/init.d/sshd start
/etc/init.d/sshd stop
/etc/init.d/sshd restart
4. Use ssh service
Xshell connects to linux:
5. Uninstall the ssh service
If you are using a series of linux distributions such as redhat, fedora, centos, etc., then type the following command:
sudo yum remove sshd
If you are using a linux distribution such as debian, ubuntu, linux mint, etc., then type the following command:
sudo apt-get –purge remove sshd
Then you will be prompted that the uninstallation is complete.