ssh-sudo-edit

Edit remote SSH text files with sudo while preserving mode and ownership.

6|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Nightreaver/python-ssh-mcp --skill ssh-sudo-edit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ssh-sudo-edit
Source: https://github.com/Nightreaver/python-ssh-mcp/tree/main/skills/ssh-sudo-edit
Command: npx skills add https://github.com/Nightreaver/python-ssh-mcp --skill ssh-sudo-edit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Editing sensitive files on remote systems securely and preserving their mode and ownership while elevating permissions to 'sudo'.

Core Features & Use Cases

  • Sudo-elevated File Editing: Perform secure text file edits over SSH with elevated privileges.
  • Mode and Ownership Preservation: Maintains the original file mode and ownership upon editing.
  • Use Case: Ideal for modifying a system configuration file while maintaining its file security and integrity, even with restricted permissions.

Quick Start

To sudo-edit the /etc/sudoers file, preserving permissions and ownership, use: ssh_sudo_edit host="prod-server" path="/etc/sudoers" old_string="your_search_text" new_string="your_replace_text"

Frequently Asked Questions about ssh-sudo-edit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I edit remote system files over SSH without changing file ownership and permissions?

To edit remote system files over SSH without changing file ownership and permissions, use sudo-elevated text file editing to perform secure string replacements while preserving the original mode and ownership of the target file.

What is the best way to modify a configuration file on a remote server with sudo privileges?

The best way to modify a configuration file on a remote server with sudo privileges is to use an SSH sudo edit tool, which elevates permissions securely during the modification and maintains file integrity.

How does sudo file editing preserve file mode and ownership on remote SSH servers?

Sudo file editing preserves file mode and ownership on remote SSH servers by elevating privileges only for the text modification process, ensuring the original file security metadata remains unchanged after the edit.

Can I use SSH and sudo to replace specific text in a remote system configuration file?

Yes, you can use SSH and sudo to replace specific text in a remote system configuration file by defining the target host, file path, exact search string, and replacement string to execute the modification securely.

When do I need to preserve file mode and ownership during remote SSH edits?

You need to preserve file mode and ownership during remote SSH edits when modifying sensitive system configuration files, such as sudoers, where altering permissions or ownership could break system security and integrity.

What are the limitations of using sudo-elevated editing for remote text file modifications?

The limitations of using sudo-elevated editing for remote text file modifications include the necessity for precise string matching, as the process relies on exact search and replace text rather than interactive editing sessions.