Advertisement

02.03.2005 at 05:56PM PST, ID: 21301342
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

OpenSSH - selectively deny SSH (shell) and permit other s* services (scp, sftp, etc)

Asked by PsiCop in Unix Network Security

Tags: , , ,

This is an informational Question that I'll ask a Moderator to close so it'll be in the solution DB.

I had a need recently to, as I migrated shell accounts off of a particular server, disable SSH for the migrated users, but still leave sftp and scp available to them; and, of course, not affect users who had yet to be migrated.

The environment was SPARC Solaris v8 using OpenSSH v3.8p1 (OpenSSL v0.9.7d) with gcc v3.3.2.

I did a LOT of searching for an answer. I tried setting the user account's shell (in /etc/passwd) to oddball things like /bin/ftponly (which was a shell script that told them they couldn't login) - that just plain didn't work; sshd choked on the script, and the user couldn't login with sftp/scp. Adding the user ID to DenyUsers in sshd_config was a bust - that not only locks them out of ssh, but also sftp and scp.  Another site suggested setting the user's shell to the sftp-server binary, but I really did not like the security implications (OK, so maybe that wasn't 100% rational, but it made my teeth itch).

Then I found Derek Martin's rssh utility (http://www.pizzashack.org/rssh). Great utility, compiled cleanly on the first try, worked as advertised. Solaris gives it problems compiling as a static binary, and the issue with compiling it as a dynamic binary is that if you don't put "PermitUserEnvironment no" in sshd_config, its possible for users to get around the restrictions (however, there's no privledge escalation issue - they can hack their own account, but not anyone else's). But I have that option set in my sshd_config anyway, so it wasn't an issue for me.

Anyway, if you find yourself in the situation of having to allow sftp/scp/rsync/rdist/cvs access but don't want to allow the user ID to ssh, and want to do it in a clean, secure manner, I think rssh fits the bill. No mucking about with scripts and no using the sftp-server binary as a shell.Start Free Trial
 
Loading Advertisement...
 
[+][-]02.04.2005 at 04:35AM PST, ID: 13224713

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Unix Network Security
Tags: deny, ssh, login, scp
Sign Up Now!
Solution Provided By: modulo
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32