From owner-freebsd-questions@FreeBSD.ORG Thu Jan 18 02:47:11 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 650DA16A4C2 for ; Thu, 18 Jan 2007 02:47:11 +0000 (UTC) (envelope-from gs_stoller@juno.com) Received: from outbound-mail.nyc.untd.com (outbound-mail.nyc.untd.com [64.136.20.164]) by mx1.freebsd.org (Postfix) with SMTP id 1E14113C442 for ; Thu, 18 Jan 2007 02:47:11 +0000 (UTC) (envelope-from gs_stoller@juno.com) Received: from webmail29.nyc.untd.com (webmail29.nyc.untd.com [10.141.27.169]) by smtpout05.nyc.untd.com with SMTP id AABC47Z5QAPWZ8RA for (sender ); Wed, 17 Jan 2007 18:46:06 -0800 (PST) X-UNTD-OriginStamp: /s5f1SIGSI3+WdnoYQ8yREKBW5peYi7jEBrYwBa7rkN3XiX0UtVczA== Received: (from gs_stoller@juno.com) by webmail29.nyc.untd.com (jqueuemail) id MCB8KN9B; Wed, 17 Jan 2007 18:45:25 PST Received: from [67.84.52.37] by webmail29.nyc.untd.com with HTTP: Thu, 18 Jan 2007 02:44:50 GMT X-Originating-IP: [67.84.52.37] Mime-Version: 1.0 From: "gs_stoller@juno.com" Date: Thu, 18 Jan 2007 02:44:50 GMT To: pieter@degoeje.nl, George.Vanev@gmail.com X-Mailer: Webmail Version 4.0 Content-Type: multipart/mixed;boundary="--__JWM__J2781.446bS.794bM" Message-Id: <20070117.184525.20085.1692098@webmail29.nyc.untd.com> X-ContentStamp: 16:8:3209236969 X-MAIL-INFO: 121941e9712020259900a981ed0959010d00797935e1b5542455c10931b0d00c699514a4b5a5d4adb03491a4d0a47d25d16ddd94c4f0d555cd80b539d07db91905649d81e055ad8574095129e4a0e0b490e9d9b1c56dad49bd7425e925f4f0714981490d61dd4d11e10190614054114d40e145c43d9135911dc17070f9e5e1a43d79e1d1099014d0f9 X-UNTD-Peer-Info: 10.141.27.169|webmail29.nyc.untd.com|webmail29.nyc.untd.com|gs_stoller@juno.com X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Subject: Re: Execute script every time a specified user logs in (FreeB SD 6.1) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2007 02:47:11 -0000 ----__JWM__J2781.446bS.794bM Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Type: text/plain A simple technique is to have /etc/profile check for user X and for= him source another file (containing the commands which X can't modify). H= ave root = own this file and allow all others to only read and execute it. sudo = is unnecessary. This is inelegant in that it has a general and widely used file look for= special cases, but that is something that almost all programs do. This inelegancy is p= resent in other places in UNIX . The text of the preceding emails is attached. ----__JWM__J2781.446bS.794bM Content-Type: text/plain Content-Description: login.tx.txt Content-Disposition: attachment; filename="login.tx.txt" Content-Transfer-Encoding: quoted-printable On 17 Jan 2007 21:42:49, Todor Dragnev wrote = To: George.Vanev@gmail.com Cc: Pieter de Goeje , freebsd-questions@freebsd.org > You can attach script to auth.info;authpriv.info in syslog.conf and = > listen for login events... > man syslog.conf(5) - look for vertical bar(pipe) functionality > On Jan 17, 2007, at 18:46 , George Vanev wrote: >> On 1/17/07, Pieter de Goeje wrote: >>> >>> On Wednesday 17 January 2007 11:49, George Vanev wrote: >>>> Every time user X (for example) logs in the system I want to execut= e some script. >>>> The user must not have the permission to change this behavior. >>>> Also the script must be run as root. >>>> Something like crontab, but depending on logins, not time >>>> >>>> Any ideas?! >>> If this user logs in via SSH you can use the ForceCommand keyword in= >>> sshd_config(5) to execute your script. The root part can be >>> achieved with sudo(8) . >>> >>> Regards, >>> Pieter de Goeje >>> >> >> Thanks, nice idea. But it seems I can't use it. >> Let me be more specific: >> If user X logs in then I want to run "/usr/bin/script -aq /path/user_= X" >> The file user_X must be protected from modifying/deleting >> >> Could this be done?! >> >> -- >> George Vanev A simple technique is to have /etc/profile check for user X and for= him source another file (containing the commands which X can't modify). H= ave root own this file and allow all others to only read and execute it. sudo = is unnecessary. This is inelegant in that it has a general and widely used file look for= special cases, but that is something that almost all programs do. This inelegancy is p= resent in other places in UNIX . ----__JWM__J2781.446bS.794bM--