help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Doing Linux admin work with Emacs


From: Richard Riley
Subject: Re: Doing Linux admin work with Emacs
Date: Wed, 08 Dec 2010 15:31:42 -0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]