From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: SU commands from Emacs Date: Fri, 24 Aug 2007 17:59:18 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87y7g1s6qx.fsf@lion.rapttech.com.au> References: <878x8ahxho.fsf@W0053328.mgh.harvard.edu> <87eji1hpmk.fsf@W0053328.mgh.harvard.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187944898 12186 80.91.229.12 (24 Aug 2007 08:41:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Aug 2007 08:41:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 24 10:41:35 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IOUjV-0006Ws-0W for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Aug 2007 10:41:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IOUjT-0005eM-4f for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Aug 2007 04:41:31 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!sn-xt-sjc-03!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:bsZ/1VsqEYagnNkp9ShogSas9yM= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 39 Original-Xref: shelby.stanford.edu gnu.emacs.help:151232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46803 Archived-At: Dieter Wilhelm writes: > jadamson@partners.org (Joel J. Adamson) writes: > >> Sometimes I want to do a command that requires root privileges. > > Yes, lately I stumbled over a find-grep in /etc. How could this be > done with root privileges? > I use either sudo or su within a shell or term buffer to run commands as root. I can't think of any straight-forward way to run elisp/emacs commands with the privileges of another user - there just isn't a mechanism to do this. The closest I could think of would be using some sort of emacsclient/emacserver setup, but this would require having another emacs running as root, which doesn't seem practicle to me. I have seen something in the most recent emacs docs that indicate tramp may be able to execute processes on remote servers. If this is the case, it should be possible, in conjunction with sudo/su as a connection method to execute commands as root via tramp. If you positively, must, have to run emacs commands as another user, I guess you could call emacs in 'batch' mode, with a function call on the command line - it may be possible to have the output sent back into a buffer in the local emacs (i.e. like output from a shell command), but this is going to be very slow and use a lot of resources (memory/cpu etc) If the reason you want to use emacs to do processing as another user is because you like to write stuff in lisp, then maybe something like lush (Lisp User Shell), rep (lisp/scheme interpreter) scsh (scheme shell) or even one of the mainstream CL implementations, like clisp, cmucl or sbcl will give you what you want. HTH Tim