Install SSH server - Linux

Install SSH on Linux: 

Install:

CentOS 6:

  sudo yum install -y openssh-server openssh-clients

CentOS 7:

  sudo yum install -y openssh-server openssh-clients

Ubuntu:

  sudo apt-get install openssh-server openssh-client

Start:

CentOS 6:

 sudo service sshd start

CentOS 7:

 sudo systemctl start sshd

 

Status: 

CentOS 6:

 

CentOS 7:

 sudo systemctl status sshd

 

Stop:

CentOS 6:

  sudo service sshd stop

CentOS 7:

 sudo systemctl stop sshd

 

Enable: To configure the sshd daemon to start automatically at boot time:

CentOS 6:
sudo chkconfig sshd --add
sudo chkconfig sshd on --level 2,3,4,5

CentOS 7:

 sudo systemctl enable sshd

 
Disable: To configure the sshd daemon to stop automatic initialization at boot time:

CentOS 6: 

 sudo chkconfig sshd off

 

 sudo chkconfig sshd --del

CentOS 7:

 sudo systemctl disable sshd 

 

SSH Config: 

sudo vim /etc/ssh/sshd_config
disable root login
 PermitRootLogin no
Change the SSH port
 Port 2222

Restart SSH service.

Add comment


Security code
Refresh

Category: