Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Help me to revert the file /root/.ssh/authorized_keys


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Help me to revert the file /root/.ssh/authorized_keys

Hi,

I copied the key of rsa.pub to authorized_keys using the below command
Code:
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

By mistake i have executed another command
Code:
view cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

so now additional keys are copied.so please help me how to revert the file ( /root/.ssh/authorized_keys).

Ubuntu 16.04


Thank you


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!
Help me to revert the file /root/.ssh/authorized_keys-ccat_screenshotpng

Last edited by RudiC; 10-09-2017 at 04:49 AM.. Reason: Added CODE tags.
# 2  
Can't you just edit the file and remove anything that shouldn't have been added?
# 3  
Thanks for your suggestion
well,I tried to do.Bit confused which one to delete in the file once i opened it.If something necessary contents are deleted then unexpected behavior will be happend

---------- Post updated at 08:45 AM ---------- Previous update was at 08:08 AM ----------

Hi All,

I created this file in another user directory.I just don't care what i need to do with the wrong data copied
# 4  
Maybe this will help???
Code:
# Move into the directory containing your files...
cd /root/.ssh

# Determine how many lines are in your corrupted file...
lines=$(wc -l < authorized_keys)

# Determine how many lines are in the file that was mistakenly added...
excess=$(wc -l < id_rsa.pub)

# Print directions...
printf 'authorized_keys contains %d lines.\n' $((lines))
printf 'id_rsa.pub contains %d lines.\n' $((excess))
printf 'Remove the last %d lines (starting with line #%d) from authorized_keys.\n' $((excess)) $((lines - excess + 1))

Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Appending authorized_keys on multiple servers using ssh
Grueben
Hi I have an ssh 'for' loop script to login and put a key on multiple servers. I need to append a file on each server but the command which works ok from the prompt does not work via the script. I have cat filename | ssh user@servername "cat >>append.file.name" I have tried to 'spawn' this in...... Shell Programming and Scripting
0
Shell Programming and Scripting
Auditors want more security with root to root access via ssh keys
dvbell
I access over 100 SUSE SLES servers as root from my admin server, via ssh sessions using ssh keys, so I don't have to enter a password. My SUSE Admin server is setup in the following manner: 1) Remote root access is turned off in the sshd_config file. 2) I am the only user of this admin...... SuSE
6
SuSE
SSH w/ command in authorized_keys apparently needs pty
KenJackson
I'm trying to have an unattended remote PC log some data on home PC. man sshd says I should be able to put a command in authorized_keys. This is what I have on the remote machine. The key is a special key that isn't used elsewhere. In my ~/.ssh/authorized_keys file on my desktop:...... Shell Programming and Scripting
12
Shell Programming and Scripting
monitoring SSH authorized_keys
prvnrk
Hi, We have around 200 SUN Servers in production environment and I have one box from where I manage all the servers. Itís setup such that I can SSH from my box onto all the 200 servers with without supplying password. It is working fine but sometimes we notice the keys getting changed and asking...... UNIX for Advanced & Expert Users
1
UNIX for Advanced & Expert Users
monitoring SSH authorized_keys
prvnrk
Hi, We have around 200 SUN Servers in production environment and I have one box from where I manage all the servers. Itís setup such that I can SSH from my box onto all the 200 servers with without supplying password. It is working fine but sometimes we notice the keys getting changed and asking...... Shell Programming and Scripting
0
Shell Programming and Scripting

Featured Tech Videos