What problem does it solve?
The Skill overcomes the challenge of safely executing file write operations with elevated privileges (sudo) on remote SSH hosts, while maintaining file ownership and permissions.
Core Features & Use Cases
- Atomic Write with Sudo: Safely writes files under sudo without leaving sensitive content in memory.
- Ownership Preservation: Ensures file ownership matches existing or specified values after write.
- Permission Bit Setting: Allows the setting of specific file permissions using octal mode values.
- Use Case: If you need to modify or create a critical configuration file on a remote server that requires sudo permissions and must be owned by a specific user or group.
Quick Start
Execute ssh_sudo_write(host="prod-server", path="/etc/app/redis.conf", content_text="maxmemory=256m", chown_user="app", chown_group="app", mode=0o640) to securely update a configuration file under sudo while maintaining proper ownership.