Solved

Linux Security: Help I have lost SSH access to my server

Posted on 2013-06-15
6
811 Views
Last Modified: 2014-07-16
Dear Experts,
I have a stand alone server hosted by an external company.

Linux CENTOS.

We have suddenly lost SSH access.  We also cannot login with the root password through cPanel control panel.

We are told all the files and folders have been changed to the permission 777 which "breaks" the server.

Is this the final story or is there any way to get back control of the server?
Best Wishes,
Phil
0
Comment
Question by:PTRUSCOTT
6 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 39249791
You should use Putty to access your server via command line.

Yes, 777 is not just a terribly bad idea but if it can break many things.   In particular, if you have public-private key mechanism enabled, it would quit working if your .ssh folder and/or files in it have world write permissions.  They have to have as restrictive permissions as possible.

Certain other mechanisms like SELinux also disble access if permissions are too open.
If you made 777 for everything on the server, you need to either get backup to the old settings or if you don't have a good backup, reinstall anyway.

See if it would manually let you access though command line or through console.
0
 
LVL 1

Author Comment

by:PTRUSCOTT
ID: 39249815
When I try to use PuTTY.esxe with the old settings (root user name) and port 22.

I get the following error message:

PuTTY fatal error message:

"Server Unexpectedly closed network connection"

Is there some PuTTY configuration to get accesss in this situation?
Best Wishes,
Phil
0
 
LVL 31

Expert Comment

by:farzanj
ID: 39249820
Do you have any other user besides root that you may use to login?  Once you get into the system, you can change user.

You need to use some utility to see if ssh is even up.  Do you have a Linux client or only Windows?

Use telnet to see if the port is advertised.
telnet server.com 22

Ping the machine to see if it is even running.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 77

Expert Comment

by:arnold
ID: 39249836
Console access is the only way.  Does the remote provider have an IP KVM that can be used to access the console?
Depending on the system maker, does it have DRAC, ILOM, LOM type of access?
It had to have been configured and the remote provider would ........

Can you go on site?

The remaining option is either have their support staff work on it if available, r have the system shipped to you,
0
 
LVL 21

Accepted Solution

by:
Mazdajai earned 500 total points
ID: 39249977
As other experts have mentioned, your only option is to try ssh in with other users and su to root.

But in the end the box still require a reinstall from a console because it is nearly impossible to fix the permission.
0
 
LVL 20

Expert Comment

by:tfewster
ID: 40200795
Reinstall and restore from backups is probably the quickest way, But for info - rpm can restore ownership and permissions of OS files:

for RPM in $(rpm -qa); do rpm --setugids --setperms $RPM; done

Open in new window


But to be able to do that you have to log in and I think the login program needs to be setuid root which `chmod 777` will have broken. You may be able to get in in single-user mode, or boot from CD and fix enough program permissions to log in.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question