Questions tagged [sudo]

29 questions
97
votes
5 answers

Edit file with super-user rights

When you have to edit system files, it's an usual situation that you launched Emacs with a normal user before, so the file will be write-protected. What can I do to gain root privileges? I mean something like M-x sudo from dired. I don't want to…
smonff
  • 1,575
  • 1
  • 15
  • 20
13
votes
2 answers

How to execute sudo command in org-babel in relative path under current working directory

I want to execute sudo command in org-babel like this: #+begin_src shell :dir "/sudo::" :cache no make sudo make install #+end_src It works fine. It use TRAMP /sudo: method. But I need to execute sudo command relative under current working…
stardiviner
  • 1,888
  • 26
  • 45
9
votes
1 answer

How to disable auto-save in emacs only for files opened as root

I want to use emacs auto-save feature with tramp, but only for file that I don't open using sudo. My current configuration, based on the tramp documentation, looks like this: ;;;;;;;; BAKUCP ;;;;;;;; ;; Backup remote files locally to stop autosave…
radious
  • 231
  • 1
  • 3
6
votes
0 answers

Cannot edit a file as root if ~/.authinfo.gpg file exists

I got ~/.authinfo.gpg to store my multiple email accounts for gnus, but if ~/.authinfo.gpg exists, the tramp won't work. It will always say: Decrypting /home/chz/.authinfo.gpg...done Emacs won't even load the file into Emacs. If I remove that file,…
CodyChan
  • 2,599
  • 1
  • 19
  • 33
5
votes
2 answers

"sudo emacs" Doesn't Work

I am trying to use sudo emacs with no luck so far. When I run with --debug-init I get the following. Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory "web-mode") Why would it be different when I am using…
Adam Thompson
  • 547
  • 3
  • 14
4
votes
1 answer

Install programs which require superuser permissions

I would like to, as part of Emacs Lisp package set-up process to run some programs which typically require superuser access, for instance, I would like to make sure that certain system packages are installed, and if not, then install them, I would…
wvxvw
  • 11,222
  • 2
  • 30
  • 55
3
votes
2 answers

Can I acquire root privilege to edit a system file without restarting emacs with `sudo`?

Sometimes, when I am running an emacs process (either started withemacs -nw or emacsclient -nw with an emacs server daemon), I would like to edit a system file. Can I acquire root privilege without restarting emacs with sudo? If I am using an emacs…
Tim
  • 4,987
  • 7
  • 31
  • 60
3
votes
2 answers

How to sudo save file in TRAMP mode?

I just started using tramp mode, and it looks amazing. However, there's one issue that's making it non-usable for me. I have several boxes which I log into with one user, say, user. He's in sudoers groups. Now when I go and edit a file, it gets…
gregoltsov
  • 155
  • 5
2
votes
1 answer

How to run sudo commands using shell-command?

When I run any sudo command using shell-command—for example, (shell-command "sudo ls")—I get the following error: sudo: no tty present and no askpass program specified How can I get around this? I'm guessing it should be possible to tell Emacs…
sid-kap
  • 544
  • 1
  • 6
  • 13
2
votes
2 answers

How to edit and save an extremely stubborn read-only file

I am trying to edit the file /etc/postfix/main.cf but this applies to any file. Currently its permission bits are set to -rw-r--r-- I want to open, edit and save this file when operating as a regular user in emacs. However, try as I might, I just…
Startec
  • 1,354
  • 1
  • 13
  • 30
2
votes
2 answers

How do I open a non-readable file from inside emacs when I opened emacs as a regular user?

The question pretty much says it all. I opened emacs as a regular user and am trying to edit something in the /etc/ folder (I know this is dangerous etc. etc.) How can I do this?
Startec
  • 1,354
  • 1
  • 13
  • 30
2
votes
1 answer

How to prevent tramp from blocking when entering password?

For my speech recognition mode I have emacs listen asynchronously using make-network-process for messages sent by my python client. If I say anything that should translate to emacs taking an action the python client send an elisp snippet to execute.…
Joseph Garvin
  • 2,061
  • 8
  • 21
2
votes
1 answer

Prevent Tramp from asking for a password for passwordless sudo

Opening /sudo::/etc/hosts with tramp prompts for a password even though I have passwordless sudo. I use ido. $ sudo grep NOPASSWD /etc/sudoers %wheel ALL=(ALL) NOPASSWD: ALL Is there any way to fix this?
1
vote
1 answer

How to overwrite protected files in dired

I was trying to copy my some of my config folders to another system which was mounted with root privileges using dired. I opened both surrounding folders using /sudo::/... and tried to copy my files from one to the other, putting again the…
1
vote
1 answer

how to execute sudo su --login username command with TRAMP

I have this weird setup that once I log onto our server with the sudo uat command, I will be logged in with my own user dadinn@uat. I have set up .ssh/config so that uat is really an alias for hostname uat.foobar.com. To access some log files, I…
Daniel Dinnyes
  • 251
  • 3
  • 13
1
2