I mistakenly edited the /etc/deny.hosts
file and added following entry-
ALL: ALL
. Now, I'm unable to do SSH into it. After searching, I found that it denies all users from accessing the system. Does any one have idea on how to overcome this?
Asked
Active
Viewed 65 times
-1
![](../../users/profiles/7303447.webp)
franklinsijo
- 15,481
- 4
- 32
- 53
![](../../users/profiles/4886861.webp)
Yogesh Jilhawar
- 3,489
- 6
- 26
- 46
-
Remove the line? – Serge Ballesta Apr 06 '17 at 14:43
-
@SergeBallesta I think the implication is that they have no access to do so. – IMSoP Apr 06 '17 at 14:43
-
@IMSoP... Right. Instance is running, but not able to do anything with it... – Yogesh Jilhawar Apr 06 '17 at 14:46
-
Is it a VM? AWS? Do you have physical access to it? Please give more details about the whole environment – andresk Apr 06 '17 at 14:47
-
@IMSoP then it lacks context on where and how the machine is hosted. If they have securely closed the door and throw the key away, it could be hard to come back inside... – Serge Ballesta Apr 06 '17 at 14:47
-
Its an AWS instance – Yogesh Jilhawar Apr 06 '17 at 14:47
-
@ Serge Ballesta : I think it should have to have some way to overcome this... – Yogesh Jilhawar Apr 06 '17 at 14:48
-
@YogeshJilhawar: I've added the aws tag for you. You should give that precision in the question itself. Unfortunately I cannot help you more because I've never used AWS instances... – Serge Ballesta Apr 06 '17 at 14:51
-
Meanwhile, since this is about systems administration, rather than programming, it should probably be on https://superuser.com (or maybe https://serverfault.com, I'm never that clear on the distinction). – IMSoP Apr 06 '17 at 14:53
-
@SergeBallesta Its a general issue and not related to only AWS. Anyways, I have added tag. and thanks for your help. – Yogesh Jilhawar Apr 06 '17 at 14:54
-
1It may be a general issue, but it has machine specific remedies. For example: Physical access -> Boot from USB stick, VM -> Boot from rescue image, server with administrative network connection -> ???, AWS -> ??? – cmaster - reinstate monica Apr 06 '17 at 14:58
-
Is it an EBS backed AWS Instance? – franklinsijo Apr 06 '17 at 15:20
-
@franklinsijo..yes – Yogesh Jilhawar Apr 06 '17 at 15:26
-
1Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Apr 07 '17 at 09:13
1 Answers
2
If the Root device of the Instance is an EBS, below steps will help you to come out of the situation.
- Stop the Instance (
Instance1
) - Detach the Root Volume
- Attach the Volume to a different running Instance (
Instance2
) as a non-Root device. - Mount the device on
Instance2
- Find the newly attached volume name using
lsblk
and then try to mount the volume.
- Find the newly attached volume name using
- Edit the
deny.hosts
file, it will be under/mountpath/etc/deny.hosts
- Detach the Volume from
Instance2
and re-Attach it to theInstance1
as Root Device.
![](../../users/profiles/4886861.webp)
Yogesh Jilhawar
- 3,489
- 6
- 26
- 46
![](../../users/profiles/7303447.webp)
franklinsijo
- 15,481
- 4
- 32
- 53
-
1
-
1
-
1@franklinsijo Thanks for the steps given. These steps are working fine. Im able to login to my server. Thanks once again!!!! – Yogesh Jilhawar Apr 06 '17 at 19:20
-
@mootmoot. Thanks for the link. Link for more info- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html – Yogesh Jilhawar Apr 06 '17 at 19:21
-
-
Few points to add:- 1) To find the attached volume name use command `lsblk`. It will give all the attached and unattached volume list. From there you can get exact volume name to mount. 2) volume attachment and detachment can only be done in instance's "stopped" state. – Yogesh Jilhawar Apr 06 '17 at 19:26