Accidentally replaced in .ssh root, unable to connect to server.

Hi all,

I was shifting some files under SFTP in .ssh and I had accidentally replaced the in the server with my Mac Pro’s Now I cannot connect to my server via ssh and console!

I have tried running the image backup but it does not seem to do any changes in regards to server settings.

What should I do? I have two sites hosted there and both are down.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The file on the server is ‘~/.ssh/authorized_keys’; you put your in this (typically a server wouldn’t even have an on it, at least not for a user account).

Console access from the DO web interface is a local terminal, so you would need to use local authentication. If you did not set a passphrase (if you preloaded your keys when creating it, there is no password set, password auth is disabled), then you would not be able to get in. There should be an option in the web interface to reset the root password; attempt this, then login via console using that password. Change that password, fix your settings, and you should be good to go.

I am not sure - I had run mysql_secure_installation before that too. After that, it keeps displaying this error : packet_write_wait: Connection to port 22: Broken pipe

Why can’t you connect via SSH and console? server-side has nothing to do with that.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel