Restricting SSH usage


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Restricting SSH usage
# 1  
Old 12-17-2008
Restricting SSH usage

Hello,

For one of our servers, we have had people trying to illegally loggon using the ssh service.
My manager has asked me to restrict ssh access to users in our internal network but close ssh access to the "outside" world.

Could someone at the very least point me to some resources on the net which could be of some use to me? There is no point asking for someone to answer such a grandiose question but getting pointed in the right direction would be appreciated.

Thanks,
# 2  
Old 12-17-2008
in /etc/ssh/sshd_config

man sshd_config

set:

ListenAddress to you local network.

ListenAddress 192.168.0.0
# 3  
Old 12-17-2008
Not sure what your Linux/Unix version is, but you could use a firewall like iptables or ipfilter to restrict access to the sshd server port. Also, some versions of sshd use tcp wrappers, so you could use hosts.deny to define restrictions.
# 4  
Old 12-17-2008
Quote:
Originally Posted by Ikon
in /etc/ssh/sshd_config

man sshd_config

set:

ListenAddress to you local network.

ListenAddress 192.168.0.0
Okay. I actually know the IP address of the FIREWALL I would have to block. How would I go about doing that? The Denygroups is a possibility based on the man page but I would like to use a command that blocks an IP address....
# 5  
Old 12-17-2008
Quote:
Originally Posted by jimbalaya
Not sure what your Linux/Unix version is, but you could use a firewall like iptables or ipfilter to restrict access to the sshd server port. Also, some versions of sshd use tcp wrappers, so you could use hosts.deny to define restrictions.
I am using CentOS release 5 (Final)
And I am using OPENSSH.

Which strategy should I take?
# 6  
Old 12-17-2008
sshd uses tcp wrappers on CentOS/RHEL. Use /etc/hosts.allow and /etc/hosts.deny

/etc/hosts.allow should have the IP range to allow:
Code:
sshd: 192.168.0.

This allows all hosts o nthe 192.168.0. subnet as an example

/etc/hosts.deny should have this entry:
Code:
sshd: ALL

This denies anyone who isn't defined in hosts.allow
# 7  
Old 03-02-2009
Error block network or ip

if i only configure the file: hosts.deny, is it okay?
because i access the server from different locations.

moreover, i know the ip/network to block. So if configure the hosts.deny file with the following line without touching the hosts.allow file. Is it okay?

sshd: 192.168.60.60 // ip to block

or/and

sshd: 123.something.something // network to block
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Xinetd flags and tcp46 socket usage to telnet / ssh via v4 and v6 addresses

Hello everyone.. I need some help in understanding the usage of tcp46 socket and xinetd.d flags.. What I'm trying to do? I'm looking to use tenet via tcp46 socket for both ipv4 and ipv6 traffic. For this, if i set flags = IPV6 xinetd.d, telnet service, i can not telnet via V4. If I unset the... (0 Replies)
Discussion started by: Sudharshan
0 Replies

2. UNIX for Dummies Questions & Answers

Restricting Usage of Setuid Programs to the Admin User In MacOsx

This is a quote from the Apple security configuration (you can download it from Apple) " Using ACLs to Restrict Usage of Setuid Programs The ACL feature of Mac OS X can also be used to restrict the execution of setuid programs. Restricting the execution of setuid programs to administrators... (3 Replies)
Discussion started by: Vera
3 Replies

3. Shell Programming and Scripting

Need help on ssh usage in a loop of shell script

I need help on how to connect remote systems through ssh command in while loop of shell script. I was able to connect one remote system using ssh from shell script. Please find sample code snippet as given below….. ssh "root@148.147.179.100" ARG1=$rpmFileName 'bash -s' <<'ENDSSH' ... (5 Replies)
Discussion started by: rajesh.tulluri
5 Replies

4. AIX

restricting sftp and ssh for a user

I want to know if there is any way to set up a users home directory access with a restricted shell and allow them to SFTP to the directory. I want to allow the user to SSH into their home directory but no where else on the AIX server. I also want the user to be able to SFTP files to their home... (1 Reply)
Discussion started by: daveisme
1 Replies

5. Shell Programming and Scripting

SSH and It's usage

Hi , I was going through a script and I saw following commands :-- OPTS="-e /usr/local/bin/ssh -ralpgHSvuz --stats --rsync-path=/usr/local/bin/rsync" OPTS="-e /usr/local/bin/ssh -vrlopgt --stats --rsync-path=/usr/local/bin/rsync" Can someone please explain the meaning of words... (4 Replies)
Discussion started by: Abhayman
4 Replies

6. Shell Programming and Scripting

SSH Usage

Hi, When i am using SSH, trying to automate some process, it seems as I am loosing environment settings that belongs to proper running of jboss server. On Server (X) a User (A) is trying to run a jboss server but the location of jboss is on the same server (X) but on different user (B) . The... (1 Reply)
Discussion started by: nimrodt
1 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. Shell Programming and Scripting

SSH usage in a script

I have configured ssh to a remote server without prompting for a password with the help of public keys...but now i am not able to execute any commands through a script what i want is a one line script which takes me directly into /var directory after executing it...searched the entire forum but... (2 Replies)
Discussion started by: roshanjain2
2 Replies

10. UNIX for Dummies Questions & Answers

Enabling backspace usage in Putty SSH connection ?

I have started a new job for 2 weeks not. I am distributing software packages through Tivoli and connecting to the servers using Putty in X11 and SSH. But on the command line, the backspace is disabled. I know its a command I have to enter in my .profile but I don't remember. There is a Ctrl+H... (2 Replies)
Discussion started by: Browser_ice
2 Replies
Login or Register to Ask a Question