Please spend few min in reading my qsn.
I'm trying to automate process of giving ssh trust (password less login ).
We do have a centralized server and users will login to all other servers from that. As remembering password for 100s of servers is impossible we will provide trust to users i.e. appending id_rsa.pub of user to authorized_keys file of other Server.
I have written a small script
1. Searches the id_rsa.pub file of user.
2. scp the id_rsda.pub of user to other Server's Particular Directory.
3. ssh root@<otherserver>
Let me share my script so that you guys can debug Please Assist me with this :
Script is here and the error i'm getting is below that. I think there is something wrong with EOF block. Rest everything worked fine. Even though i have 24 lines of code I'm getting line 25 : syntax error
#! /bin/bash
read a
read b
read c
if [ -f $a ]
then
echo " $a pub key exists and checking "
if [ "$b" == "vfilvtest" ]
then
echo "can provide trust"
scp $a
root@$b:/home/$c/.ssh
ssh root@$b <<EOF
cd /home/$c/.ssh
cat $a >> authorized_keys
exit
EOF
echo "trust is provided"
else
echo "u don't have access"
fi
else
echo "No user pub key"
fi
[root@vf2lvtest testprograms]# ./prog3
user3
vfilvtest
ramat1
./prog3: line 25: syntax error: unexpected end of file