CONFIGURING KEY BASED SSH AUTHENTICATION


CONFIGURING KEY BASED SSH AUTHENTICATION

yum search ssh
yum install openssh-server.x86_64
failed
(if yum is locked
then update it
yum update) - need to check
bcz yum packet manager actually occupied with package git
ps -aux | grep -i packge
now allow port
iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT
firewall-cmd --permanent --add-port=22/tcp

systemctl start sshd

now connect
in linux
ssh username@ip -p <portno>
in windows
connect using putty

password less login
secure bcz if someone know username and pwd they connect the server easily
pwdlesslogin provide connecting server with keys

edit config file
vi /etc/ssh/sshd_config
PermitRootLogin no (by default it is yes with #)
RSAAuthentication yes - insert it
PubkeyAuthentication yes - uncomment it
PasswordAuthentication no(by default it is yes)

after changes
systemctl restart sshd

now go to client and make preparations for pwd less login and attemp the login by generating key

ssh-keygen

asks for enter file in which to save the key
it is ok with default location
then import this key to the server

ssh-copy-id user@ip
pwd: type it for that user

now try login in the client

ssh user@ip
pwd

error
agent admitted failure to sign using the key

then trouble shoot
 insert nothing in below

echo " " > /home/neelima/.ssh/authorized_keys
cd /home/neelima/.ssh/
ls
cat authorized_keys
rm authorized_keys
service sshd restart
(try to generate other keys and import generated ssh key from client to server)
ssh-keygen
it asks for passphrase - we don't have just enter
now import
ssh-copy-id neelima@192.168.0.84

in client server type below cmd

ssh-add
means which will (identity added)
now attempt to login

it works

+++++++++++++++++++++++++++++++

COPY FILES
 copying local files to remote site

scp <filepath> remotesite:path

ex:

scp /root/hi.txt neelima@192.168.0.83:/home/divya/Downloads

encryption layer exist while tranferring files so nobody can see it

it asks for password of neelima user exist in that remote site
pwd: enter it

go to rmote site and check

Comments

Popular posts from this blog

Power Broker

zabbix-introduction

variables in shell scripting