LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-30-2015, 08:26 AM   #1
amazme
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Rep: Reputation: Disabled
Cannot SSH after changing permissions in root folder


Hello Guys,

Im fairly new to linux and was mucking around with permissions on root the other day and lost my connection via ssh. Now when i try to connect via ssh I get an error 'connection refused'. My system logs show the following:

Starting sshd: /var/empty/sshd must be owned by root and not group or world-writable.
[FAILED]

I gather this is because I changed some permissions on root. Thing is, as Im unable to connect via ssh, how else can I correct this issue? Im desperate as I have some data on there that I dont want to lose.

Thanks
Mark
 
Old 04-30-2015, 09:41 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,647

Rep: Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501Reputation: 2501
you need to login in at the console, probably that works.
 
Old 04-30-2015, 09:57 AM   #3
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 54
Did you try changing the owner to root and changing the permissions so that it's not group or world writable? Could always uninstall/reinstall
 
Old 04-30-2015, 07:55 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,392

Rep: Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652
Do you remember the command that you ran? You might of mucked more then just ssh and we need some more details. Do you have local access to the server?
 
Old 04-30-2015, 09:00 PM   #5
amazme
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi Guys,

I changed the permissions in root dir using the following command:

chown -R xxxx:xxxx /var *

I was mucking around with a Joomla install trying to get stuff copied but screwed things up, i know stupid play.

So, using Putty or WinSCP i just cant get access to it at all. Connection refused error. What other console do you refer to?

If I can change the permissions back to root:root as they were I think it should fix this as the error relates to SSH not loading under my local user permissions
 
Old 04-30-2015, 09:13 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,392

Rep: Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652
Do you have local access to the server i.e can you sit in front of the physical machine?
 
Old 04-30-2015, 09:14 PM   #7
amazme
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Do you have local access to the server i.e can you sit in front of the physical machine?
Nope - This is a virtual amazon ec2 instance launched through them.
 
Old 04-30-2015, 09:50 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,392

Rep: Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652Reputation: 1652
I'm not familiar with EC2 but it appears that if you can not connect via ssh there is not other way to gain access. Without knowing anything about what type of storage, backups or snapshots I can not say anything about how to get to your data except to contact Amazon.
 
Old 05-01-2015, 02:11 AM   #9
RMLinux
Member
 
Registered: Jul 2006
Posts: 260

Rep: Reputation: 37
try this first: type #service sshd start may be accidentally stop.


try to edit your /etc/ssh/sshd_config

change "PermitRootLogin yes"

then restart the sshd

type: # service sshd restart

try to read this also http://www.linuxquestions.org/questi...ddress-610246/

Last edited by RMLinux; 05-01-2015 at 02:13 AM.
 
Old 05-03-2015, 07:17 AM   #10
amazme
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by RMLinux View Post
try this first: type #service sshd start may be accidentally stop.


try to edit your /etc/ssh/sshd_config

change "PermitRootLogin yes"

then restart the sshd

type: # service sshd restart

try to read this also http://www.linuxquestions.org/questi...ddress-610246/
Hi RMLinux,

I'd love to try the above however I cannot access the command prompt window using Putty to try those commands or even access the files with WinSCP to try and edit the config.
I get 'Connection Refused' error hence my initial post. Unless you can tell me another way to follow your suggestions?
 
Old 05-03-2015, 08:38 AM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,336

Rep: Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824Reputation: 824
Suggest you contact amazon and see if they can support you, without any shell access to this machine you are pretty screwed. If you have FTP access then depending on the FTP client you MAY be able to change permissions there. The fact that you also appear to have changed owners right down the /var tree would also be problematic. You'll probably find that it's going to be quicker to delete that instance and re-create it from your last valid backup.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing folder permissions and its sub folder and files? stratotak Linux - Newbie 6 12-29-2011 05:11 AM
Changing permissions of a folder knobby67 Linux - Software 5 10-04-2009 08:13 AM
Changing Permissions on Root Folder acascianelli Linux - General 1 08-04-2006 03:28 PM
Having problems changing permissions on a folder zener Linux - Security 16 12-19-2005 09:32 AM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM


All times are GMT -5. The time now is 05:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration