BM: Baca dalam Bahasa Melayu
World L2: Keys & Staff
Change the owner: chown
You will learn: to hand a file or folder to another user or group with sudo chown.
Checked with Linux (Debian 13) on 1 Nov 2026
The problem
Customers upload photos of their food. The web staff, user www-data, saves them in /srv/kedai/uploads. Every upload fails. Why?
Pick one answer.
Watch
sudo -u www-data runs one command as the web staff. Real error: Permission denied. Plain words: uploads is yours, and others have no w key.
Predict
You own uploads. Can you give it away yourself with chown www-data uploads?
Pick one answer.
Try it
Hand the folder to the web staff and their group: sudo chown www-data:www-data uploads.
You are you in /srv/kedai. 2 things here. Services: cron running, ssh running, nginx running.
you@kedai:/srv/kedai$Folder /srv/kedai
- menu.html (file)
-rw-r--r-- - uploads/ (folder)
drwxr-xr-x
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Hint
chown means “change owner”. The form isowner:group.Check
chmod or chown? Pick the right tool.
Drag a card into a box. Or tap the card, then tap the box.
Try it
The folder is handed over. Test it as the web staff: sudo -u www-data touch uploads/a.jpg.
You are you in /srv/kedai. 2 things here. Services: cron running, ssh running, nginx running.
you@kedai:/srv/kedai$Folder /srv/kedai
- menu.html (file)
-rw-r--r-- - uploads/ (folder)
drwxr-xr-xnot yours
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Hint
touch makes an empty file, like a test upload.You did it!
You can now hand files and folders to the right owner.
Go deeper (optional)
sudo chown -R www-data:www-data uploads changes a folder and everything inside: check the path twice. sudo chown :kitchen roster.txt changes only the group. Never hand your whole home to another user.
Real rep (optional): on Linux, ls -l /var/www shows who owns the web files.
Bahasa Melayu
Pelanggan muat naik gambar makanan mereka. Pekerja web, pengguna www-data, simpan gambar itu dalam /srv/kedai/uploads. Setiap muat naik gagal. Kenapa?
sudo -u www-data jalankan satu arahan sebagai pekerja web. Ralat sebenar: Permission denied. Maksudnya: uploads milik anda, dan orang lain tiada kunci w.
Anda pemilik uploads. Bolehkah anda sendiri serahkannya dengan chown www-data uploads?
Serahkan folder itu kepada pekerja web dan kumpulan mereka: sudo chown www-data:www-data uploads.
pemilik:kumpulan.chmod atau chown? Pilih alat yang betul.
Folder sudah diserahkan. Uji sebagai pekerja web: sudo -u www-data touch uploads/a.jpg.
touch buat fail kosong, macam muat naik ujian.Kini anda boleh serahkan fail dan folder kepada pemilik yang betul.
You finished this before. Practice is always welcome!
Official docs: chown (Debian 13 man page) · GNU coreutils: chown invocation
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?