Allow some users from certain IP access to openssh on AIX.


We want to allow access to OPenssh to user1, user2 and user3 but ONLY from these IPs:


So access from user1@*, user2@*, user3@*  (any other IP) must be denied.

And all other users/groups can access the system via SSH.

Which do you think is thepossible  combination of:


inside /etc/ssh/sshd_config file?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Israel,

I think sshd_config's allow/deny stuff cannot do that, unless you were willing to add all your users to the AllowUsers stanza.

But if you have access to the authorized_keys file(s) of the target user(s) you can add a from=.. statement
to the public key entry/entries pertaining to the source user(s).


from="IP1" ssh-rsa AAAAB2...............19Q== user1@hisdomain.tld

You can also use patterns, and there are more options which can be placed into the authorized_keys file.

I think you should read the "authorized_keys File Format" section in the sshd manpage and experiment a bit.
I once had some success using the "command=..." feature which automatically starts the given command
for the respective user and ignores everything else, but I admit I never used "from=..."
CSIA ANAuthor Commented:

I'll take a look to "authorized_keys File Format", but I think it's not what customer wants. At first glance, it seems not to be a solution inside sshd_config file? I have tried with sshd_config but not success.
Let me check "authorized_keys File Format"
No, it's not a solution inside sshd_config.

You could do it via sshd_config and its AllowUsers facility, but then you would have to add all users to that stanza,
user1/2/3 along with their IPs, all other users wildcarded or without IP.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CSIA ANAuthor Commented:
OK.. I'll take a look at ssh keys.

Thanks again wmp..

Have a good day!
Thx for the points and have a good day, too!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.