Ubuntu 16.04 Emacs 26.1 Emacs needs to open the file with root privileges. Here is my code:
(secrets-delete-item "session" "Login")
(secrets-create-item "session" "Login" "myParol" :method "sudo" :host "iemuser" :user "iemuser")
;(secrets-show-secrets)
; session
; `-[-] Login
; |- password: myParol
; |- host: iemuser
; |- user: iemuser
; |- method: sudo
; `- xdg:schema: org.freedesktop.Secret.Generic
(setq auth-sources '("secrets:session"))
(find-file "/sudo::/usr/share/emacs/24.5/lisp/gnus/auth-source.el.gz")
and again Emacs persistently requires a password: Password for /sudo:root@iemuser
: How to get Emacs to take the password from my Ubuntu login.
Addition details from the comments:
iemuser@iemuser
is not a mistake:- The localhost is named
iemuser
- I am logged in to that host (and running Emacs on that host) as a user with that same name,
iemuser
- The localhost is named
- In emacs I wish to programmatically open a root-owned file on this localhost for editing. i.e.:
/sudo::/path/to/file
- My goal is to not be prompted for a sudo password when this happens -- rather, I want emacs to handle the authentication
- I am trying to use
auth-sources
andsecrets
to achieve this
Password for /sudo:root@iemuser
" indicates that you're not actually accessing the correct path. I strongly suspect you've tried to access/sudo:iemuser:...
which means "log me in as usernameroot
on the hostiemuser
" (henceroot@iemuser
in the prompt). The correct syntax (which is common to tramp paths in general) is/sudo:USER@HOST:
with thesudo
method usingroot@
as the default user when no username is given. The incorrect attempt may also have created aC-h v tramp-default-proxies-alist
entry for the bad hostname. – phils Mar 19 '19 at 22:30iemuser
? Is theiemuser
host also the localhost, or is it remote? – phils Mar 20 '19 at 9:57(find-file "/sudo::/usr/share/emacs/24.5/lisp/gnus/auth-source.el.gz")
ought to be accessing that path on localhost, not on theiemuser
host (although if there's an unfortunatetramp-default-proxies-alist
entry from a use of incorrect syntax it's possible for localhost paths to end up being proxied to a remote host, but that's very much dependent on the specific proxies which are defined). – phils Mar 20 '19 at 10:03tramp-devel@gnu.org
. Michael, Tramp maintainer. – Michael Albinus Mar 20 '19 at 14:11