Sponsored Content
Top Forums Shell Programming and Scripting Find active SSH servers w/ ssh keys on LAN Post 303025446 by syrius on Friday 2nd of November 2018 01:33:01 PM
Old 11-02-2018
What is not working is this part exactly:

Code:
if ssh -l $users -i $ssh_keys $hosts_known -o BatchMode=yes -o ConnectTimeout=5
then echo $users:$hosts_known:$ssh_keys SUCCESS >> results.txt
else
echo $users:$hosts_known:$ssh_keys FAILED >> not-active.txt
fi

You can see what it should do but actually my syntax seems incorrect because nothing gets into the file results.txt & not-active.txt.

------ Post updated at 05:33 PM ------

You can see below the output I am getting when launching the bash script:

Code:
root@blackb0x:/home/sirius/TEST# ./TEST3.sh
We have 6 hosts_known.txt known hosts that could be still active via SSH keys
ssh: Could not resolve hostname sirius: Name or service not known
root@blackb0x:/home/sirius/TEST# ls
bash_users  cutted.bash_users  cutted.bash_users_home_dir  cutted.ssh_keys.txt  hosts_known.txt  not-active.txt  ssh-keys.txt  TEST3.sh
root@blackb0x:/home/sirius/TEST# cat not-active.txt
root sirius postgres:6 hosts_known.txt:/root/.ssh/id_rsa /home/sirius/.ssh/id_rsa /var/lib/postgresql/.ssh/id_rsa /var/lib/postgresql/.ssh/id_rsa.pub FAILED

Seems like I have a syntax error in my bash script...
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

SSH Keys Help

Hello, I'm wondering if anyone has a step-by-step instruction set for setting up ssh keys? I've gone through many of the manuals online (most seem to be from the same source) and it's a little bit unclear when the documentation is talking about the server versus the client machine. I'm missing... (1 Reply)
Discussion started by: sysera
1 Replies

2. UNIX for Dummies Questions & Answers

ssh public keys

Hello*! I have problems with public keys. On one side i have Solaris 10, and on other side is HP UNIX. I created public keys on Solaris with "ssh-keygen -t rsa", append id_rsa.pub key to ~user/.ssh/authorized_keys on remote machine, and tried to connect with ssh without password. But for some... (1 Reply)
Discussion started by: ghost01
1 Replies

3. UNIX for Dummies Questions & Answers

SSH keys

Hi everyone, i wanted to generate ssh keys so that i can include the public key in the remote sever, so that for subsequent logins, i can do away with the keying in of the password. I consulted the man ssh-keygen man pages. "..Normally each user wishing to use SSH with RSA or DSA... (1 Reply)
Discussion started by: new2ss
1 Replies

4. Shell Programming and Scripting

Sharing SSH Keys

I have 2 systems A and B I need to do a passwd less authentication inorder to send a file from system B to system A automatically(using sftp) for this i did the following I generated ssh-keygen -t dsa on system B, copied this key(id_dsa.pub) into the authorized_keys file on system A... (1 Reply)
Discussion started by: ramky79
1 Replies

5. Red Hat

SSH keys are not working

Hi, I've generated and posted pub. keys in the source system and the target. However, it is still prompting me for the password. Steps that I have taken. 1. Generated ssh keys : ssh-keygen. It created two files. 1. .ssh/id_rsa 2. .ssh/id_rsa.pub. 2.... (10 Replies)
Discussion started by: Afi_Linux
10 Replies

6. Shell Programming and Scripting

How helpful are ssh keys?

Hi frnz, I work in an environment, where I need to login to multiple UNIX sessions(Always types my password when prompted for) I heard of ssh keys which provides us a valid authentication and that avoids us typing the password. Now I want to generate the ssh keys and use in my... (2 Replies)
Discussion started by: dnam9917
2 Replies

7. OS X (Apple)

rsync and ssh keys help

Not specifically a mac question, but it's what I am using. I am setting up some replication for some file shares using rsync. The problem is that I am being given a little bit of a twist - I'm supposed to use a non-admin account to do it with. I have 2 boxes - Master and Slave with 1... (2 Replies)
Discussion started by: kleinboy
2 Replies

8. Solaris

help with SSH keys

Hello, I could use some help with my ssh keys and agent. This is the issue. I have 2 different UNIX systems at work. One is the normal Solaris servers with my uid being the same throughout all the servers. I now have a different system for my desktop. A contractor came in and installed some SUN... (0 Replies)
Discussion started by: bitlord
0 Replies

9. UNIX for Beginners Questions & Answers

Find number of ACTIVE SSH putty sessions, excluding where the user hopped on to a diff server

Hi - If iam logged on to server A, on 4 putty windows using SSH ... and out of these 4 logged-in sessions, in one of the sessions if i did SSH from server A to server B; i would now have 4 putty windows sessions ... of which 3 are actively logged on to Server A while 1 putty window is actively... (2 Replies)
Discussion started by: i4ismail
2 Replies
bssh/bvnc/bshell(1)					      General Commands Manual					       bssh/bvnc/bshell(1)

NAME
bssh/bvnc/bshell - Browse for SSH/VNC servers on the local network SYNOPSIS
bssh bvnc bshell DESCRIPTION
bssh/bvnc/bshell browses for SSH/VNC servers on the local network, shows them in a GUI for the user to select one and finally calls ssh/vncviewer after a selection was made. If the binary is called as bssh only ssh servers will be shown. If the binary is called as bvnc only VNC servers will be shown. If the binary is called as bshell both VNC and SSH servers are shown. OPTIONS
-s | --ssh Browse for SSH servers (and only SSH servers) regardless under which name the binary is called. -v | --vnc Browse for VNC servers (and only VNC servers) regardless under which name the binary is called. -S | --shell Browse for both VNC and SSH servers regardless under which name the binary is called. -d | --domain= DOMAIN Browse in the specified domain. If omitted bssh/bvnc/bshell will browse in the default browsing domain (usually .local) -h | --help Show help. AUTHORS
The Avahi Developers <avahi (at) lists (dot) freedesktop (dot) org>; Avahi is available from http://avahi.org/ SEE ALSO
avahi-browse(1), ssh(1), vncviewer(1) COMMENTS
This man page was written using xml2man(1) by Oliver Kurth. Manuals User bssh/bvnc/bshell(1)
All times are GMT -4. The time now is 06:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy