get ssh key comment


 
Thread Tools Search this Thread
Special Forums Cybersecurity get ssh key comment
# 1  
Old 03-05-2012
get ssh key comment

Hey Guys,

I have a server, and a technical user on it (only for reading logs). I set up openssh, and the user can login only with ssh key pair.
Under this one technical user, there are a lots of public keys in the ~/.ssh/authorized_keys file. I would like to find out/log with which key the user authenticated.

I have start to create a bash script, what starts right after the login, reads the security log for the key fingerprint and saves it to a variable, reads the authorized_keys file line by line and generates the fingerprints then comapres the fingerprints and after the match, logger sends the comment from the public key to the logs...

"My bash" is not so good, so I wonder if there is any other simple or elegant solution for this? Any help would be great. Thanks.
Peter.-
# 2  
Old 03-05-2012
Unfortunately I can't fiddle with my own SSH server here without losing contact so I can't give details but I see some pitfalls in that approach.

Putting the key in a log available to anyone sounds dangerous. If just the line number would be possible, that may be sufficient.
# 3  
Old 03-05-2012
A better approach might be to set the appropriate sshd logging level and parse the resulting sshd logfile for that information.

What OS and distribution are you on?
# 4  
Old 03-05-2012
I set the loglevel to debug, but unfortunately the logs do not conatains the informations I need. I see only the tty number/PID/key fingerpring.
The OS is RHEL5 x64
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

SSH key issue

Hello I have AIX server as a source server and destination is Linux server. I have configured the ssh key as below.... generated rsa key on aix with userA and copied the public key to on linux server in userB/.ssh/authorized_keys but when i try ssh userB@linux server its again asks me for... (4 Replies)
Discussion started by: powerAIX
4 Replies

2. Red Hat

Ssh-key issue

Hi all, I have generated pass phrase key from Linux and copied into windows system. Then now we cant login to Linux from windows without that pass phrase key, unfortunately i forgot the pass phrase key. I have tried below procedures to recover it. 1. Have regenerated the id_RSA key again... (3 Replies)
Discussion started by: mastansaheb
3 Replies

3. UNIX for Dummies Questions & Answers

Ssh key for an OS group

Hello, i was talking to an expert in my work and i requested him to import my ssh public-key in the ~/.ssh/authorized_keys on a remote host. but he told me that he only import OS groupkey(not OS user key). so he asked me to give him the output of (id -a) user1@hostname$ id -a... (3 Replies)
Discussion started by: amr.emam
3 Replies

4. AIX

Help with ssh key exchange

Hi I have two aix lpars with version 7.1. i created a user named test in both the lpars. in one of the lpar i ran ssh-keygen -t rsa -b 2048 and got the publickey. i copied this public key to the authorized_keys of the other server. when i do ssh its asking for password? please assist (2 Replies)
Discussion started by: newtoaixos
2 Replies

5. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

6. Shell Programming and Scripting

Using ssh to add register key on ssh server

Hi, I want to use ssh to add a register key on remote ssh server. Since there are space characters in my register key string, it always failed. If there is no space characters in the string, it worked fine. The following is what I have tried. It seems that "ssh" command doesn't care about double... (9 Replies)
Discussion started by: leaftree
9 Replies

7. UNIX for Advanced & Expert Users

ssh key

Hi all, I have a sshkey which I use to connect from my unix box to a linux box without any issue...... however I downloaded this same key to my laptop and tried to connect to the same linux box but it failed..... As my laptop is running MS Vista I guessing I going have to convert it ...... (1 Reply)
Discussion started by: Zak
1 Replies

8. Cybersecurity

SSH key code versus server key code

Hi, When logging in using SSH access (to a remotely hosted account), I received a prompt to accept a server's key fingerprint. Wrote that string of code down for comparision. Already emailed my host for their listing of the string of code for the server's key fingerprint (for comparison,... (1 Reply)
Discussion started by: Texan
1 Replies

9. UNIX for Dummies Questions & Answers

SSH key authentication

Hi all, I have got a Solaris machine and I have several user account setup up with the .ssh and authorized_keys file in their home directories. I have check all the permission and ownership and they are all indentical and belongs to the user ID and group respectively. However one of the... (3 Replies)
Discussion started by: stancwong
3 Replies

10. AIX

key ssh

hello I want to connect from server1 to server2 (Aix 5.3) with ssh, without password prompt. So i define a ssh-key On server1: ssh-keygen -b 1024 -f identity -P '' -t dsa scp identity.pub toto@server2:/tmp/identity-.pub On server 2: cat identity-.pub >> .ssh/authorized_keys chmod 400... (2 Replies)
Discussion started by: pascalbout
2 Replies
Login or Register to Ask a Question