How to "sudo su" inside gedit to save mounted file

Maybe this is an obvious one.

Let's say I mount a remote server using Nautilus (which is running on my laptop) and I'm not root on the remote server, and I want to use gedit to save a file owned by root on the remote server, is it possible for me to "sudo su" on the remote server from inside gedit so I can save the file?

I can edit the file from the shell, but I'd rather use gedit. Does this make sense? Both remote server and my laptop using Fedora.

Also I could just chown the file but I'd rather leave it as root:root.

3 Replies

Why would you "sudo su"? That's pretty redundant in most cases…

Why not save the file as a normal user, then copy it in place as root?

@JshWright:

Why would you "sudo su"? That's pretty redundant in most cases…

Why not save the file as a normal user, then copy it in place as root?

I don't have the root password, I'm a user working for somebody.

I chown'd the file, works fine with gedit now (I asked the client first) so problem solved.

But I'm still interested if there's a way to have gedit automatically "sudo whatever" so I can edit files with "root" ownership.

(Yes, I'm pretty much a Linux noob.)

If you're editing your sever from a mounted drive, you can't sudo (or gksudo in your case) into it. You can only log in as root.

Editors like vim that live in the command line are a lot more efficient at editing text than gedit, once you learn them a bit. In addition you avoid these inconveniences.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct