Title: Cursor Editor Fails to Save Files Requiring Sudo Permissions
Error Message:
Failed to save ‘hosts’: Command failed: cd “/home/nasser”; “/usr/bin/pkexec” --disable-internal-agent /bin/bash -c “echo SUDOPROMPT; "/tmp/.mount_cursorJ2dXA6/usr/share/cursor/bin/cursor" --file-write "/home/nasser/.config/Cursor/code-elevated-3SHUG2Jz"”
/bin/bash: line 1: /tmp/.mount_cursorJ2dXA6/usr/share/cursor/bin/cursor: Permission denied
Issue Description:
When attempting to save files that require sudo permissions (like /etc/hosts), Cursor fails with a permission denied error. The error occurs because:
- Cursor is trying to use pkexec (graphical sudo prompt) to handle elevated permissions
- The command is failing because it’s trying to execute Cursor from within its temporary mount point (/tmp/.mount_cursorJ2dXA6/)
- The temporary mount point has restricted permissions that prevent the sudo operation from working
Steps to Reproduce:
- Open a file that requires sudo permissions (e.g., /etc/hosts) in Cursor
- Make changes to the file
- Attempt to save the file
- The error occurs when Cursor tries to use pkexec for elevated permissions
Expected Behavior:
Cursor should successfully save files requiring sudo permissions, similar to how VSCode handles it.
Actual Behavior:
The save operation fails with a permission denied error, making it impossible to edit files requiring sudo permissions directly in Cursor.
Workaround:
Currently, the only workaround is to use a different editor (like VSCode) for files requiring sudo permissions.
Environment:
- OS: Linux 6.11.0-25-generic
- Cursor: Latest version (AppImage)
- File System: Ext4