all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Riley <rileyrg@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Doing Linux admin work with Emacs
Date: Wed, 13 Oct 2010 14:12:33 +0200	[thread overview]
Message-ID: <i947ni$m0q$1@quimby.gnus.org> (raw)
In-Reply-To: 70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com

bebop52 <gruenderteam.berlin@googlemail.com> 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.


       reply	other threads:[~2010-10-13 12:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com>
2010-10-13 12:12 ` Richard Riley [this message]
2010-10-13 12:19 ` Doing Linux admin work with Emacs Pascal J. Bourguignon
2010-10-14  2:34   ` Barry Margolin
2010-10-14  8:17     ` Olivier Sirven
2010-10-14 10:17     ` Miles Bader
2010-10-14 12:46       ` bebop52
2010-10-14 15:00         ` Pascal J. Bourguignon
2010-10-14 21:42         ` Tim X
2010-10-15  1:50       ` Barry Margolin
2010-10-16  3:16         ` Miles Bader
2010-10-13 21:20 ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='i947ni$m0q$1@quimby.gnus.org' \
    --to=rileyrg@googlemail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.