Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a server setup with several domains and subdomains.

I'd like to limit ssh and sftp access so a user can only connect to xxx.domain1.com but I'm not sure where this is configured.

Connecting via ay other domain/subdomain on the server should be refused.

Thanks,

J

share|improve this question
    
Why are you trying to do this? It makes no difference in the end whatsoever. –  fahadsadah Jun 6 '10 at 13:03
add comment

2 Answers

up vote 3 down vote accepted

Since SSH doesn't know something like the Host header in HTTP/1.1, you cannot deny a specific user to login to your server. The SSH daemon can't know which domain originally resolved to the IP address it is listening on.

You could only get another IP address, set it as A resource record for subdomain.example.com and allow the user only to login on that specific IP address.

share|improve this answer
add comment

I believe you can use the hosts.allow and hosts.deny files to limit access to sshd.

Add the following line to /etc/hosts.deny:

sshd: ALL

And add the following to /etc/hosts.allow:

sshd: xxx.domain1.com

Additionally, you can use denyhosts to further protect sshd from unwanted access.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.