-1

sudo echo "sadfsadf" > /etc/apache2/mods-available/dir.conf

I ran the command with sudo but it returned the error: "permission denied:

Why does this command not work?

redaced
  • 9
  • 4

1 Answers1

0

sudo xxx > file does not work as expected. xxx is executed as root, but the filewrite (>) is still 'executed' as the current user.

sudo -s and then execute the command with the pipe.

MrTux
  • 32,350
  • 30
  • 109
  • 146