Wednesday, October 14, 2015

SSH Server to manage a server from the remote computer centos 6

     
This tutorial will guide you on how  to configure SSH Server to manage a server from the remote computer. SSH uses port number 22 and uses TCP protocol. SSHd is installed when you install CentOS , so it's not necessarry to install new packages. Furthermore, SSHd is set auto-start setting by default, so it's possible to login without chainging ant settings. But it had better to change for security settings like follows.


[root@easylinux ~]# vi /etc/ssh/sshd_config

# line 42: uncomment and change ( prohibit root login remotely )

PermitRootLogin no

# line 65: uncomment

PermitEmptyPasswords no

PasswordAuthentication yes

[root@easylinux ~]# /etc/rc.d/init.d/sshd restart

Configure SSH client of CentOS.


Install SSH client.

[root@client ~]# yum -y install openssh-clients

Connect to the SSH server with a common user.

# ssh [username@hostname or IP address]

[root@client ~]# ssh user@easylinux.always.com

The authenticity of host 'easylinux.always.com (<no hostip for proxy command>)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:60:90:d8.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'easylinux.always.com' (ECDSA) to the list of known hosts.
user@easylinux.always.com's password: # password of the user

[user@easylinux ~]$ # just logined


it's possbile to execute commands on remote Host with adding commands to ssh command.

# for example, open /etc/resolv.conf on remote host

[user@client ~]$ ssh user@easylinux.always.com "cat /etc/resolv.conf"

user@easylinux.always.com's password:

nameserver 8.8.8.8
nameserver 8.8.4.4

No comments:

Post a Comment