Insufficient write permission to the media root #9567
-
Hello everybody! I'm having issues with image upload and i'm stuck. I think my permissions are correct but obviously not. Been looking for other threads for clues but no luck. This is what i get:
When i check folder and files everything seems fine or at least exactly as my other netbox installation. Here's a snippet:
If i look at the devicetype-images folder it looks like this:
What do i need to do? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
The directory must be writable by the user as which NetBox runs (typically named |
Beta Was this translation helpful? Give feedback.
-
Brian,
Thanks for your response. This is a brand new install. The service file does show that it’s using the user netbox. Any help would be greatly appreciated.
[Unit]
Description=NetBox WSGI Service
Documentation=https://docs.netbox.dev/
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=netbox
Group=netbox
PIDFile=/var/tmp/netbox.pid
WorkingDirectory=/opt/netbox
ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi
Restart=on-failure
RestartSec=30
PrivateTmp=true
[Install]
WantedBy=multi-user.target
***@***.***:/opt/netbox/contrib$ ps auxwww | grep netbox
www-data 1021 0.0 0.1 29632 21988 ? S 01:17 0:07 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
www-data 1072 0.0 1.0 208176 170384 ? S 01:17 0:08 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
www-data 1105 0.0 1.1 222600 184708 ? S 01:17 0:26 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
www-data 1106 0.0 1.0 204764 172696 ? S 01:17 0:15 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
postgres 51161 0.0 0.1 218160 23788 ? Ss 16:05 0:00 postgres: 12/main: netbox netbox 127.0.0.1(60018) idle
postgres 51181 0.0 0.1 219480 24568 ? Ss 16:06 0:00 postgres: 12/main: netbox netbox 127.0.0.1(60022) idle
postgres 51334 0.0 0.1 218020 24848 ? Ss 16:09 0:00 postgres: 12/main: netbox netbox 127.0.0.1(60046) idle
root 70990 123 0.8 180428 139184 ? R 21:49 0:02 python3 /opt/netbox/netbox/manage.py rqworker directory = /opt/netbox/netbox/ user = www-data
dwoods3+ 70994 0.0 0.0 6432 720 pts/0 S+ 21:49 0:00 grep --color=auto netbox
***@***.***:/opt/netbox/contrib$ sudo cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:103:106::/nonexistent:/usr/sbin/nologin
syslog:x:104:110::/home/syslog:/usr/sbin/nologin
_apt:x:105:65534::/nonexistent:/usr/sbin/nologin
tss:x:106:111:TPM software stack,,,:/var/lib/tpm:/bin/false
uuidd:x:107:112::/run/uuidd:/usr/sbin/nologin
tcpdump:x:108:113::/nonexistent:/usr/sbin/nologin
landscape:x:109:115::/var/lib/landscape:/usr/sbin/nologin
pollinate:x:110:1::/var/cache/pollinate:/bin/false
usbmux:x:111:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
sshd:x:112:65534::/run/sshd:/usr/sbin/nologin
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
dwoods3-adm:x:1000:1000:Darren Woods:/home/dwoods3-adm:/bin/bash
lxd:x:998:100::/var/snap/lxd/common/lxd:/bin/false
postgres:x:113:118:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
redis:x:114:119::/var/lib/redis:/usr/sbin/nologin
Thanks,
Darren Woods
On Jul 17, 2022, at 12:05 AM, Brian Candler ***@***.******@***.***>> wrote:
**THIS EMAIL IS FROM AN EXTERNAL SENDER OUTSIDE OF THE ALAMO COLLEGES.
Be cautious before clicking links or opening attachments from unknown sources. Do not provide personal or confidential information.**
How are you starting Netbox? If it's via systemd as per the current installation instructions, then the user will be set in the service file<https://smex-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fnetbox%2dcommunity%2fnetbox%2fblob%2fmaster%2fcontrib%2fnetbox.service%23L10%2dL11&umid=0ddd7268-476a-4ef9-81f0-29fabd7ce392&auth=d92b6398b351c9b13ed6363a6e9883f7e86857eb-5175e5db0dcf29a1b4b07d1a5879152c025cc2c0>.
If this Netbox was installed a long time ago - by which I mean more than 2-3 years ago - then older instructions showed running it as "www-data" user, since this already exists on many systems. And in that case you may also find Netbox being started from supervisord rather than systemd.
If your Netbox is actually working, you can always just look at running processes: the first column will give the user ID.
ps auxwww | grep netbox
You're not using docker are you? If so, obviously no user will be created on your host. Inside the container, I'm not sure - it looks like it might be using a user "unit"<https://smex-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fnetbox%2dcommunity%2fnetbox%2ddocker%2fblob%2frelease%2fdocker%2flaunch%2dnetbox.sh%23L55&umid=0ddd7268-476a-4ef9-81f0-29fabd7ce392&auth=d92b6398b351c9b13ed6363a6e9883f7e86857eb-097afac3b7205b5a6297c1f298d8ad7d45d999b5>
—
Reply to this email directly, view it on GitHub<https://smex-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fnetbox%2dcommunity%2fnetbox%2fdiscussions%2f9567%23discussioncomment%2d3164049&umid=0ddd7268-476a-4ef9-81f0-29fabd7ce392&auth=d92b6398b351c9b13ed6363a6e9883f7e86857eb-d054e4905cf0f6c29057fcabb855fb89655f8fc5>, or unsubscribe<https://smex-ctp.trendmicro.com/wis/clicktime/v1/query?url=https%3a%2f%2fgithub.com%2fnotifications%2funsubscribe%2dauth%2fA2AHQCAXY54E6EFBZGYJHOLVUOICDANCNFSM5ZJBUT5A&umid=0ddd7268-476a-4ef9-81f0-29fabd7ce392&auth=d92b6398b351c9b13ed6363a6e9883f7e86857eb-46c952ae1b855df9aac81089cf6d211ce9e907cd>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Yes, probably. |
Beta Was this translation helpful? Give feedback.
-
So I chowned the directory to my user, added the old files, then chowned it to the netbox user. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
The directory must be writable by the user as which NetBox runs (typically named
netbox
). You can try assigning this user to thewww-data
group and changing the directory to chmod 775 to grant write access.