I want to move a file from my Raspberry Pi (Openhabian OS) to a USB stick, however the cp command returns cp dir1/Controller.py /media/usb/ cp: cannot create regular file '/media/usb/Controller.py': Permission denied.

I tried to get permission via chown and chmod:

chmod 777 /media/usb/
sudo chown openhabian:openhabian /media/usb/

These two went through without an issue, however the problem remains.

The attribute change I tried using

sudo chattr -i /media/usb/

returned the error:

chattr: Inappropriate ioctl for device while reading flags on /media/usb/

How can I get the permissions I need to write on /media/usb/ ?


The input

openhabian@openHABianPi:~$ ls -ld /media/usb/


drwxrwxrwx 1 openhabian openhabian 4096 Nov 13 19:44 /media/usb/

and the input

openhabian@openHABianPi:~$ mount | grep media/usb


/dev/sda1 on /media/usb type ntfs (rw,relatime,uid=1000,gid=1000,fmask=0177,dmask=077,nls=utf8,errors=continue,mft_zone_multiplier=1)

2 Answers 2


From the output, you can not change file attributes on ntfs. chattr: Inappropriate ioctl for device while reading flags on /media/usb/ ; chattr is only for Linux systems, aka, supported filesystems, like xfs,ext4, etc, but also, there are some minor limitations as well. You can not use it on ntfs based filesystem.

man chattr


In my case, the problem was try to set immutable in a file, but the file was a symbolic link. Chattr not is to set flags in symbolic links.

I removed the symbolic link and recreate as file and then set immutable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .