Reputation: 1263
if the command is with a pipe, how to deal with permission problem with sudo the following command
sudo -u liy echo "update moz_cookies set value='f1=40000000&f3=40000&fv=11.2.202' where name='PREF' and host='.youtube.com';"|sqlite3 /user/liy/home/.mozilla/firefox/dd1pkryp.default/cookies.sqlite
leads to problem:
cannot open directory /user/liy/home/.mozilla/firefox/: Permission denied
how to deal with this? thanks
Upvotes: 3
Views: 70
Reputation: 129099
Put the sudo
on the command doing the modifying:
echo 'some SQL' | sudo sqlite3 /some/database.db
You might even consider using a heredoc:
sudo sqlite3 /some/database.db <<ENDOFSQL
-- SQL here; you can even use multiple lines!
ENDOFSQL
Upvotes: 4