Access to particular IP's from the solaris/LINUX server

Hi All,
I have a scenario here where in I need to allow a user from the server(Solaris or LINUX) to be able to ssh to a particular set of IP's.
Eg:user1 should be able to access IP's 10.26.32.2,10.26.32.7,10.26.32.9
user2 should be able to access IP's 10.1.1.2,10.1.1.4(just an example)

So I need to create the users such that they are able to access only these IP's.If they try to ssh to any other IP's they should not be able to do so.

Please let me know if we can do so and if yes how to do the same.

Thanks in Advance...

One way, I guess:

Create a group in /etc/group on each remote node - icanssh as an example
Assign those users who are allowed to ssh into the machine to that group only on that machine.

Then in /etc/ssh/sshd_config add a line:

AllowGroups root icanssh

It is just easier and safer to deny all access for those users to a given node - disable their account. Or remove shell access
by defining the shell as /bin/false

As a general, deny all access, then grant access just to those who need it - is a far safer strategy

Hi Jim,
Thanks a lot

The problem here is the remote machine can be a server,router,switch etc.
I want to control all the stuff in the server itself.
So I want to maintain an access list file kind of stuff and what ever IP's are there in the file the user will be able to access only to those IP's.If the user tries to access any other IP apart from those in the list he should not be allowed.
So I am not sure if we require a script for this or can is it achievable thro configuration...

Thanks