OpenSSH : Password Authentication
Configure SSH Server to operate servers from remote computers.
[1]. OpenSSH is already installed by default even if you installed CentOS with [Minimal] Install, so it does not need to install new packages. You can login with Password Authentication by default. However by default, root user account is allowed to login, so it had better to change the setting.
[root@dlp ~]# vi /etc/ssh/sshd_config
# line 46: change ( prohibit root login )
# for other options, there are [prohibit-password], [forced-commands-only]
PermitRootLogin no
[root@dlp ~]# systemctl restart sshd
[2]. If Firewalld is running, allow SSH service. SSH uses [22/TCP].
[root@dlp ~]# firewall-cmd --add-service=ssh --permanent
success
[root@dlp ~]# firewall-cmd --reload
success
SSH Client : CentOS
Configure SSH Client for CentOS.
[3]. Install SSH Client.
[root@client ~]# dnf -y install openssh-clients
[4]. Connect to SSH server with any common user.
# ssh [username@(hostname or IP address)]
[root@client ~]# ssh cent@dlp.srv.world
The authenticity of host 'dlp.srv.world (10.0.0.30)' can't be established.
ECDSA key fingerprint is SHA256:8Z/t+IUd/X5K991abSyV6zML+6GeoGmfTUibuTOt++w.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dlp.srv.world,10.0.0.30' (ECDSA) to the list of known hosts.
cent@dlp.srv.world's password:
Activate the web console with: systemctl enable --now cockpit.socket
[cent@dlp ~]$ # logined
[5]. It's possbile to execute commands on remote Host with SSH like follows.
# for example, run [cat /etc/passwd]
[cent@client ~]$ ssh cent@dlp.srv.world "cat /etc/passwd"
cent@dlp.srv.world's password:
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
.....
.....
chrony:x:990:986::/var/lib/chrony:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
cent:x:1000:1000::/home/cent:/bin/bash
Comments
Post a Comment