FG
💻 Software

Bash "Permission denied" issue when trying to append to EOF

Fresh5 days ago
Mar 15, 202612221 views
Confidence Score0%
0%

Problem

When trying to push a couple lines to the end of a file, I get a permission issue. I understand why I'm getting the error, but I can't think of a way to resolve it. Any help would be appreciated.

Error Output

sudo cat > /etc/php5/apache2/php.ini << EOF
    # extensions
    extension=”memcached.so”
    extension=”apc.so”
EOF

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash "Permission denied" issue when trying to append to EOF

Low Risk

Heredoc usage, or "appending to EOF", is not the problem. All redirections (including ) are applied before executing the actual command. In other words, your shell first tries to open for writing using your account, then runs a completely useless . …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment