Raspberian, apache2, python3, flask, I need to change network settings.
But when I try:
f = open('/etc/network/settings.txt', 'w') \
f.write('1234')
It gives me an error:
PermissionError: [Errno 13] Permission denied: '/etc/network/settings.txt'
I really dont understand what is going on.
I try to change apache2 settings :
<Directory />
AllowOverride All
Require all granted
Allow from all
</Directory>
Add to apache2.conf
and to /sites-avialable/webapp.conf
, but it is doesn't work
Looks like you don't have write-access to /etc/network/settings.txt. You need to either run the script as root/sudo or give your account permission to write the file with chown and chmod.
Tutorials with examples on how to change ownership and permissions on files: https://www.howtoforge.com/linux-chown-command/ https://www.howtoforge.com/tutorial/linux-chmod-command/
Created file named settings.txt
chmod 777 settings.txt
add to apache2/sites-enabled/webApp.conf:
<Directory /etc/network/>
Order deny,allow
Allow from all
</Directory>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.