Skip to content

Update the torrc in GitHub Actions #24937

Answered by airtower-luna
Lyro1 asked this question in Actions
Discussion options

You must be logged in to vote

This doesn’t work because of how shell redirection works: If you do

sudo echo "ControlPort 9051" >> /etc/tor/torrc

what happens is:

  • The command sudo echo "ControlPort 9051" is executed
  • The output of that command is redirected and appended to /etc/tor/torrc

That redirect is done by the shell that executes your command, it is not part of the sudo command, so it runs with regular user rights. Only echo runs as root. 😅

To make it work you need to make the process that writes to the file run as root. Two common solutions:

  1. Wrap everything in a root shell. You can do that by creating a script file and running that with sudo, or by wrapping the command with bash -c:
sudo bash -c 'echo "Cont…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants