Home  >  Article  >  Operation and Maintenance  >  What to do if the ssh command cannot be found under Linux

What to do if the ssh command cannot be found under Linux

青灯夜游
青灯夜游Original
2023-02-17 11:46:413579browse

Solution: 1. Execute the "yum install ssh" command to install the SSH service; 2. Execute the "service sshd start or /etc/init.d/sshd start" command to start the SSH service; 3. Execute the "vi /etc/ssh/sshd_config" command to edit the SSH service configuration file; 4. Modify the default port number to 10022; 5. Change the firewall configuration and open the 10022 port.

What to do if the ssh command cannot be found under Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

The ssh command under Linux cannot be found because the SSH service is not installed. If you want to use the ssh command, you need to reinstall it.

Use the command to detect whether the SSH service has been installed on the Linux system

rpm -qa |grep ssh

If the SSH software package is not installed, you can install it through yum or rpm Install the package

Install and configure the SSH service under Linux

1. Install the SSH service through the yum installation package

yum install ssh

2. After the installation is complete, start the SSH service

service sshd start 或 /etc/init.d/sshd start

3. View and edit the SSH service configuration file

vi /etc/ssh/sshd_config

4. Modify the default port number to 10022

Use the VI command to press "i" on the keyboard to enter the editing state, find the line "#port 22", remove the "#" in front of it, and replace Modify port 22 to 10022; press the "ESC" key to exit the editing state; press and hold the "SHIFT:" key at the same time, enter "wq" to save and exit! Of course, after modifying the configuration file, you need to restart the SSH service!

5. Change the firewall configuration

After completing the above steps, we found that we cannot connect to Linux using port 10022. This is because the Linux firewall is doing something weird, so we need to open port 10022!

  • Use the command to view the firewall configuration information

service iptables status

As you can see from the screenshot, I have opened port 10022 ! The specific opening command is: (iptables -I INPUT -p tcp --dport 10022 -j ACCEPT Use service iptables save to save the configuration and restart the firewall!)

Related recommendations: "Linux Video Tutorial

The above is the detailed content of What to do if the ssh command cannot be found under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn