LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 10-04-2010, 10:38 PM   #1
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Rep: Reputation: 1
hosts.allow - permission denied


Hi all,

After I type sshd: 192.168.1.11 : allow and

sshd : ALL : Deny

I can't access hosts.allow or deny any more.

It says "Permission denied"

Before I typed that, I can access hosts.allow and deny.

What to do now? Please help... Thanks a lot.

By the way, I was wondering what command to edit hosts.allow.

For example, I want to put sshd: xxx.xxx.xxx.xxx : allow in that file.

Again, thanks....
 
Old 10-04-2010, 10:45 PM   #2
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Quote:
Originally Posted by rainlinux View Post
Hi all,

By the way, I was wondering what command to edit hosts.allow.

For example, I want to put sshd: xxx.xxx.xxx.xxx : allow in that file.

Again, thanks....
Although your question is not very clear, i conclude that You want to edit hosts.allow and hosts.deny file
You can use any editor like vi, nano etc to edit hosts.allow or hosts.deny file.
root# vi /etc/hosts.allow
..

Thanks
 
Old 10-04-2010, 11:09 PM   #3
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 79
Quote:
Originally Posted by rainlinux View Post
Hi all,

It says "Permission denied"
run as root to edit or use sudo to edit.
 
Old 10-04-2010, 11:09 PM   #4
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Original Poster
Rep: Reputation: 1
Thanks Vishesh,

Actually, I have two questions.

1. I can't access the hosts.allow anymore (the reason I memtioned above), how to fix it?

2. Although I can't edit(access) hosts.allow for now, I still want to know the command to edit the file. (Thank you for your answer for this question)
 
Old 10-04-2010, 11:10 PM   #5
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 79
sudo nano hosts.allow
 
Old 10-04-2010, 11:51 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
so you are on a remot terminal and used ssh . Then told the host.allow file to have "all deny "added to it

1)so you told the remote system to deny ALL connections
2) or at least ALL connections from YOUR ip address "192.168.1.11"

if "2"

use a different computer on a different network to login and undo what you did

if "1" you need to be sitting in front of the computer ,to fix.
 
Old 10-05-2010, 01:09 AM   #7
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Original Poster
Rep: Reputation: 1
Thanks all,

John VV,

I was just wondering how to undo what I did.

My purpose is deny all ssh connections, except 192.168.1.11

Thank you
 
Old 10-05-2010, 01:20 AM   #8
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
In hosts.deny:
Quote:
SSHD: ALL
In hosts.allow:
Quote:
SSHD: 192.168.1.11
Implicit deny all and allow one
 
Old 10-05-2010, 08:35 PM   #9
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Original Poster
Rep: Reputation: 1
Hi all,

I already put SSHD: ALL in hosts.deny and SSHD: 192.168.1.11 in hosts.allow

But my redhat still allow me remote login.(I did this with another pc)

I even disabled ssh service through usr/sbin/setup > system services > unselect sshd

I can still login through ssh.

Please help, Thank you so much.

ps: I did above steps NOT using pc with 192.168.1.11
 
Old 10-05-2010, 10:16 PM   #10
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
From my notes, has a few additional ssh security functions as well.

/etc/hosts.allow
sshd: xxx.xxx.xxx.xxx/255.255.255.0 #Network Adress
sshd: xxx.xxx.xxx.xxx #Single IP Address

/etc/hosts.deny
sshd: ALL
sshd1: ALL
sshd2: ALL
sshdfwd-X11: ALL
 
Old 10-05-2010, 11:19 PM   #11
raviteja_s
Member
 
Registered: Jun 2010
Location: India
Distribution: Redhat
Posts: 68

Rep: Reputation: 1
Try these steps:

vim /etc/hosts.deny


sshd: ALL EXCEPT 192.168.1.11

Last edited by raviteja_s; 10-05-2010 at 11:21 PM.
 
Old 10-05-2010, 11:49 PM   #12
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
My hosts.deny:
Code:
ALL: ALL
# End of hosts.deny.
Everything is blocked

My hosts.allow
Code:
ALL: 127.0.0.1
#telnet replaced by ssh (2006-05-23 by WimS)
#in.telnetd: 172.31.212.19
vsftpd: 172.31.212.148
sshd: 172.31.212.148
# End of hosts.allow.
All localhost to access all services
vsftpd and sshd from one machine only

Wonder if the contents of the file is not case-sensitive ?
 
Old 10-06-2010, 01:11 AM   #13
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Original Poster
Rep: Reputation: 1
Thanks you guys

The weird thing is I even disabled the sshd service as I said above ( usr/sbin/setup > system services > unselect sshd)

Why I can still apply remote control through "putty" (ssh)?

Thank you
 
Old 10-06-2010, 01:42 AM   #14
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
I don't know how sshd is started on your system. Might be that the disabling (as you did) only takes effect at boot and that you still have to stop the ssh daemon manually.

I might have missed it, but which distro are you using?
 
Old 10-06-2010, 01:57 AM   #15
rainlinux
LQ Newbie
 
Registered: Oct 2010
Posts: 16

Original Poster
Rep: Reputation: 1
Thanks Wim Sturkenboom

I'm using Redhat 7.0
 
  


Reply



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
Permission Denied bazutti Linux - Newbie 2 10-16-2009 03:19 PM
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM
Permission denied? soujrnr Linux - Software 2 07-18-2004 07:35 AM
IP still denied, after removed from hosts.deny anth2oo1 Linux - Security 13 05-06-2003 07:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:07 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
Open Source Consulting | Domain Registration