How to Tramp with ssh and sudo?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Tramp with ssh and sudo?

Pankaj Jangid-2
Need some help with Tramp. I know that to access a remote file the path
is

/ssh:user@host:/path/to/file

For privileged file on local machine, it is

/sudo::/path/to/file

I want to combine the above two i.e. I want to access a privileged file
on a remote machine. What is the path for that?

Regards
--
Pankaj Jangid



Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Michael Albinus
Pankaj Jangid <[hidden email]> writes:

Hi,

> Need some help with Tramp. I know that to access a remote file the path
> is
>
> /ssh:user@host:/path/to/file
>
> For privileged file on local machine, it is
>
> /sudo::/path/to/file
>
> I want to combine the above two i.e. I want to access a privileged file
> on a remote machine. What is the path for that?

/ssh:user@host|/sudo:host:/path/to/file

> Regards

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Pankaj Jangid-2
Michael Albinus <[hidden email]> writes:
> /ssh:user@host|/sudo:host:/path/to/file

I typed exactly this with appropriate user and host values. But this
didn't work. My remote host is a raspbery-pi

C-x C-f /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf <RET>

This didn't work.

Regards
--
Pankaj Jangid

Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Tomas Zerolo
On Fri, Jan 10, 2020 at 09:08:40AM +0000, Pankaj Jangid wrote:
> Michael Albinus <[hidden email]> writes:
> > /ssh:user@host|/sudo:host:/path/to/file
>
> I typed exactly this with appropriate user and host values. But this
> didn't work. My remote host is a raspbery-pi
>
> C-x C-f /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf <RET>
>
> This didn't work.

How does your "not work" look, exactly? Any error messages? Emacs
hangs? It gives you an empty buffer and says it's a new file?

Hint: the more details you give, the more you help others help you :)

Cheers
-- tomás

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Michael Albinus
In reply to this post by Pankaj Jangid-2
Pankaj Jangid <[hidden email]> writes:

> I typed exactly this with appropriate user and host values. But this
> didn't work. My remote host is a raspbery-pi
>
> /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf

D'oh! There's a typo.

/ssh:pi@192.168.0.3|sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf

> Regards

Best regards, Michael.

Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Pankaj Jangid-2
Michael Albinus <[hidden email]> writes:
>> I typed exactly this with appropriate user and host values. But this
>> didn't work. My remote host is a raspbery-pi
>>
>> /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf
>
> D'oh! There's a typo.
>
> /ssh:pi@192.168.0.3|sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf

Best!!!

This worked. Thanks a lot, Michael.

Regards,
--
Pankaj Jangid

Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Pankaj Jangid-2
In reply to this post by Tomas Zerolo
<[hidden email]> writes:

>> Michael Albinus <[hidden email]> writes:
>> > /ssh:user@host|/sudo:host:/path/to/file
>>
>> I typed exactly this with appropriate user and host values. But this
>> didn't work. My remote host is a raspbery-pi
>>
>> C-x C-f
>> /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf
>> <RET>
>>
>> This didn't work.
>
> How does your "not work" look, exactly? Any error messages? Emacs
> hangs? It gives you an empty buffer and says it's a new file?

Really sorry about that. Actually, I copied the message but forgot to
yank in the message buffer before sending. The problem got solved with
Michael's help. But the message in the message area was

M-x make-directory <RET> <RET> to create the directory and its parents

Regards,
--
Pankaj Jangid

Reply | Threaded
Open this post in threaded view
|

Re: How to Tramp with ssh and sudo?

Tomas Zerolo
On Fri, Jan 10, 2020 at 11:47:40AM +0000, Pankaj Jangid wrote:

> <[hidden email]> writes:
> >> Michael Albinus <[hidden email]> writes:
> >> > /ssh:user@host|/sudo:host:/path/to/file
> >>
> >> I typed exactly this with appropriate user and host values. But this
> >> didn't work. My remote host is a raspbery-pi
> >>
> >> C-x C-f
> >> /ssh:pi@192.168.0.3|/sudo:192.168.0.3:/etc/wpa_supplicant/wpa_supplicant.conf
> >> <RET>
> >>
> >> This didn't work.
> >
> > How does your "not work" look [...]

> Really sorry about that [...]

No worries. Perhaps I sounded grumpier than intended.

Michael nailed it anyway :-)

Cheers
-- t

signature.asc (205 bytes) Download Attachment