From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: Doing Linux admin work with Emacs Date: Wed, 13 Oct 2010 14:12:33 +0200 Organization: aich tea tea pea dicky riley dot net Message-ID: References: <70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291953824 2677 80.91.229.12 (10 Dec 2010 04:03:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 04:03:44 +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 Dec 10 05:03:40 2010 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.69) (envelope-from ) id 1PQuCq-0007HK-3N for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Dec 2010 05:03:40 +0100 Original-Received: from localhost ([127.0.0.1]:49187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQuCp-0004dH-BZ for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 23:03:39 -0500 Original-Path: usenet.stanford.edu!goblin2!goblin1!goblin.stu.neva.ru!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 73 Original-NNTP-Posting-Host: 85.183.18.158 Original-X-Trace: quimby.gnus.org 1286971954 22554 85.183.18.158 (13 Oct 2010 12:12:34 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Wed, 13 Oct 2010 12:12:34 +0000 (UTC) User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:181753 X-Mailman-Approved-At: Thu, 09 Dec 2010 20:23:37 -0500 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:77308 Archived-At: bebop52 writes: > Hello, > I think it's very nice to use emacs as "operating system" on top of > linux (Ubuntu Lucid 10.0.4 in my case). Especially dired is a > wonderful tool in my eyes. > > When I start Gnu Emacs 23.1.1 with "myUser$ sudo emacs" (with myUser > having admin rights) I can do everything I want, since Emacs acts as > root-user. Which is very comfortable, but has a few negative side- > effects: > > a) It means any new files/folders have owner and group 'root', but > should have owner 'myUser' and group 'myUsersGroup'. > > b) Furthermore, many programs put some files or folders in the active > users home directory during installation. For example maven puts its > repo under ~/.m2/repository/. My maven repository ended up under > root/.m2/repository/, because emacs acted as root user, so that was > the home directory. > > c) Isn't it very dangerous to do websurfing with w3m after starting > emacs with "sudo emacs"? Any malware could potentially act as root > user, if there are security wholes in w3m or emacs. But when I do > admin work, I always have to google some stuff and end up in the web. > > On the other hand, if I do "myUser$ emacs" (with myUser having admin > rights), without sudo, I can do admin work from the eshell using sudo > when necessary. But what about dired, for example? How can I give > emacs dired temporarily and in a controlled way admin rights (via > sudo) while running it as 'myUser' and not as 'root'? > > I'm still looking for a decent workflow that enables me to open emacs > in the morning via xterm or gnome and stay in emacs all day, do the > admin/filesystem stuff as admin (but often via dired, if possible), > work as a standard user with sudo rights when writing or programming, > and surfing the web as a limited user without admin rights and with > little security risks. And being able to swich effortlessly between > the different roles. > > Thanks for any help from wiser minds to a relative beginner in the > linux/emacs universe > t. > The first thing I would say is this : do not run emacs as root for your day long session. It's asking for trouble. What admin tasks are you doing so frequently that you feel you need an editor with root rights all the time? There are various ways to open files in emacs as root. Google can help. One such is: ,---- | (defun find-alternative-file-with-sudo () | "Open current buffer as root!" | (interactive) | (when buffer-file-name | (find-alternate-file | (concat "/sudo:root@localhost:" | buffer-file-name)))) | | (global-set-key (kbd "C-x C-r") 'find-alternative-file-with-sudo) `---- The odd time you need to be root with dired? open a shell and su or run another short lived emacs instance for that bit of stuff you want to do. It is simple too dangerous to be running emacs as root all day long IMO but your tastes might vary.