From owner-freebsd-questions@FreeBSD.ORG Sat Feb 5 23:00:09 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B068016A4CE for ; Sat, 5 Feb 2005 23:00:09 +0000 (GMT) Received: from smtp9.wanadoo.fr (smtp9.wanadoo.fr [193.252.22.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3765D43D39 for ; Sat, 5 Feb 2005 23:00:09 +0000 (GMT) (envelope-from atkielski.anthony@wanadoo.fr) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0908.wanadoo.fr (SMTP Server) with ESMTP id 6D45B1C0012D for ; Sun, 6 Feb 2005 00:00:08 +0100 (CET) Received: from pix.atkielski.com (ASt-Lambert-111-2-1-3.w81-50.abo.wanadoo.fr [81.50.80.3]) by mwinf0908.wanadoo.fr (SMTP Server) with ESMTP id 423C51C0012B for ; Sun, 6 Feb 2005 00:00:08 +0100 (CET) X-ME-UUID: 20050205230008271.423C51C0012B@mwinf0908.wanadoo.fr Date: Sun, 6 Feb 2005 00:00:07 +0100 From: Anthony Atkielski X-Priority: 3 (Normal) Message-ID: <971531375.20050206000007@wanadoo.fr> To: freebsd-questions@freebsd.org In-Reply-To: <20050205100125.C47038@starfire.mn.org> References: <51563600.20050205125343@wanadoo.fr> <20050205100125.C47038@starfire.mn.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: Running top without a shell -- more questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Feb 2005 23:00:09 -0000 John writes: J> I am not seeing what you are seeing. I see a login process hanging J> around with the regular shells, just like you are describing for top. It has occurred to me that all my other logins are ssh, so maybe that's the difference. I don't have telnetd running at all. J> There's no magic about being a shell. You could write your own. J> Login isn't treating top any differently than a conventional shell J> in my system. OK. Which by extension means that there aren't any big security concerns in writing a special-purpose program that replaces the shell for a specific user, right? For example, if one user is allowed to execute only a single interactive program and nothing else, I could just run that program as his shell and not allow him to run a conventional shell at all, right? If so, it seems like that would be a lot more secure, provided that the replacement program doesn't have any shell-like functions (such as user-initiated calls to other programs) that could be exploited to breach security. Heck, that would mean that I could even set up a special user that does nothing but allow someone to play "adventure," no? J> Once upon a time, like version 7 Unix, login would simply make an J> exec-family call to replace itself with the desired "shell" after J> doing all the setup, ID's changes, and so forth, and that would J> cause init to spawn a new getty when the wait for that pid returned. J> It was simple, and it was elegant, it reclaimed the resources used J> by login (this was in the days of 64k data space + 64k program code J> space, period), but there was no reliable way to collect logout J> information, so that hasn't been true in a long, long time. Someone gains the terminal back after logout (init?); wouldn't that program be able to handle logout accounting? J> What you could do is actually not run login, either. You could J> modify /etc/ttys to call your own little buffer program. You J> do NOT want to change /etc/ttys to run top directly, because it J> would be running as root, and top has a built in k (kill) command, J> so you would not want to have that! I prefer to avoid changing any of the standard software; updates become a nightmare when you have custom mods out there. I've modified login programs on other systems (not UNIX systems), and they are maintenance and security nightmares, although you can do all sorts of cool stuff. Thanks for the other suggestions, though. I'll look them up if I ever wish to again tread the dangerous path of site modifications to standard software (right now, I just don't have the time to open that can of worms, alas!). -- Anthony