Home > Operation and Maintenance > Linux 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

青灯夜游
Release: 2023-02-17 11:46:41
Original
3655 people have browsed it

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
Copy after login

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
Copy after login

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

service sshd start 或 /etc/init.d/sshd start
Copy after login

3. View and edit the SSH service configuration file

vi /etc/ssh/sshd_config
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template