SSH protocol:
- SSH is the abbreviation of Secure Shell (secure shell)
SSHD service:
- Open a system service of SSH protocol
port:
- The default port of the SSH service is 22
The following commands are performed with root privileges
One, in Ubuntu
Step 1: Install SSH service
- Execute the following command, it will be installed automatically by default
apt-get install ssh
Step 2: You can check which processes are occupied by port 22 (this step can be omitted)
- After opening, you can check whether port 22 is enabled
netstat -antp | grep sshd
- Or check which processes occupy port 22
lsof -i :22
Step 3: Install the SSH server
- Execute the following command to install
apt-get install openssh-server
Step 4: Check your ip address
- Enter the following command to view, you can use the SSH service
ifconfig
Two, CentOS
Step 1: Check whether the SSH service is installed
- Use the following command to check whether it is installed, the icon shows mine is already installed
rpm -qa | grep ssh
- If it is not installed, use the following command to install
yum install openssh-server
Step 2: Turn on SHH service
- Restart the SSH service: service sshd restart
- Start the SSH service: service sshd start
- Stop the SSH service: service sshd stop
- After opening, you can check whether port 22 is enabled (this step can be omitted)
netstat -antp | grep sshd
- Or check which processes occupy port 22 (this step can be omitted)
lsof -i :22
Step 3: Set the SSH service to start automatically after booting
- Auto-start at boot: chkconfig sshd on
- Turn off automatic startup: chkconfig sshd off