Plugged in a the sd card of Raspberry Pi to my computer, I wanted to move files to the /root directory. Since it is owned by root user and permissions of drwx------. I had to do chown -R myuser:myuser to /media/myuser/rootfs.

Does this affect security on my RPi or could have adverse effects? Is this the proper way to manage permissions? Should I revert ownership back to the root user?


It is not a good idea to change ownership and permissions on files from another operating system on a SD Card that is attached with a card reader to your computer. At least it affects security because a user has access to maybe password containing files and other important things. You also changed drastically permissions by removing all of them for groups and others. This can break the operating system because it is possible that it missed permissions to access or execute files managed by group members or allowed for general access. You should revert all ownership and permissions to its original state and never touch it when managing the SD Card on your computer.

Because you are able to change ownership and permissions on your computer, I assume you are running a Unix like operating system on it. To manage the files on the SD Card just do it with root rights. You can prepend commands with sudo, e.g.

computer ~$ sudo cp /source/path/new_wpa_supplicant.conf /media/myuser/rootfs/etc/wpa_supplicant/wpa_supplicant.conf

You can also switch to a root shell with sudo -Es. Then you don't need to prepend sudo. But have attention with it because you are root now. Any serious command will also be executed. If you do not have sudo available you can just execute su to become root.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.