0

So I am trying to copy a file from my home pi directory to USB on my Pi zero as root using sudo mv command and it still says permission denied. I am a root user. How do I copy this file if I don't have the permission even as root?

screenshot 1screenshot 2screenshot 3screenshot 4screenshot 5

4
  • 1
    It may help if you translate the messages in your screenshot to English to show what each message says. Also, consider that a directory may not have write permissions which can be resolved with chmod +w some/directory Feb 1, 2019 at 16:10
  • 1
    It seems that your trying to copy a file to external drive. Please edit your question and include the output of mount | grep /media/pi/0ABE2571BE255688. Also, at least for posting to AU please switch to English.
    – Kulfy
    Feb 1, 2019 at 16:22
  • You can copy and paste the output directly to question body instead of posting images. Also, which distro are you using on your pi?
    – Kulfy
    Feb 3, 2019 at 15:37
  • See my pathlld script: github.com/waltinator/pathlld.git - Bash script to answer "Why can't I read/write that file?"
    – waltinator
    Feb 3, 2019 at 15:39

1 Answer 1

0

Could you check the output of the command ls -alh in both the directories ie /home/pi and /media/pi. That command will basically show the owner of the file (along with other info) that you are trying to move/copy. Also since you are already in /home/pi directory, perhaps just try to use this command (wondering if double quotes was leading to an issue!):

mv vortexcomputers.py /media/pi/0ABE2571BE25568B/

Also, try creating a test file in /media/pi directory by using this command : touch test_file.txt

You should then be able to list the files to check if the file got created successfully.

Let me know how it goes.

5
  • Ok thank you! I will truly the commands you told me and let you know how it goes soon(when I am on Pi again) probably tomorrow. In the meantime basically the message in the image says cannot create file blah blah blah permission denied. So it does not have permission to create file in that directory. Although I don't know why it says create when I am trying to move the file. Anyway I will try the commands and let you know how it goes.
    – stefmz 7
    Feb 2, 2019 at 17:35
  • Hi! I tried everything you told me. Still getting the same message. The output of the ls -alh command showed that the file I want to copy and my USB drive are owned by Pi. Though when I tried copying it both as Pi and root it didn't work. Also tried without quotes didn't work. Also gave writing permissions didn't work. Any other ideas? I am including screenshots in my question (edit).Also I am gonna edit my question to include the output of the mount|grep command as you told me. By the way creating a test text file in media/pi worked.
    – stefmz 7
    Feb 3, 2019 at 15:24
  • Hi, looks like your media/pi directory doesn't have write permissions (even though you mentioned that you have given write permissions). Could you try again by giving write permissions using command : chmod +w media/py. Also, Pls create the test file as well using the touch command etc and then show the output of ls -alh. Feb 3, 2019 at 19:45
  • If you look at the output of ls -alh command in your screenshot, you would see that the write permission is missing in /media/pi directory and its sub-directories. Hence as suggested by @kristopher-ives as well above, you just need to give the write permission by using chmod +w 0ABE2571BE25568B command. It would then become drwxrwxrwx instead of drwxr-xr-x which is shown currently in the screenshot. You could also use chmod 777 0ABE2571BE25568B , both commands would give the same result. Let me know how it goes! (This is just a case of missing write permission on the directory) Feb 4, 2019 at 10:31
  • Ok thanks! But I solved my problem otherwise. I got a USB to Ethernet card and I uploaded the files to the cloud. But I might try this just for science:).
    – stefmz 7
    Feb 4, 2019 at 20:28

You must log in to answer this question.

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