WinSCP Permissions tip
-
If you are having trouble with your permissions when editing your config files like I was then there is a quick way to make WinSCP give you root access. I read this but still had issues due to my lack of expertise. I found that if you choose "Advanced" before logging in with WinSCP (you'll probably need to press "Edit" first) and then click "Shell". You can then add this:
sudo su -
then hit OK. After that, you will have root access forever. Works great.
-
Is this ok to use or will it change permissions to root on the files that need pi permissions?
-
This will make it so any file you create will be owned by root instead of by pi. Which is likely not what you want.
A better solution would be to get something like PuTTY to connect to the pi (same connection info as WinSCP)
and just run
sudo chown pi:pi /home/pi/somethingorother
literally change ownership of a file to user:pi group:piOr, if its an etc file
sudo chmod o+w /etc/emulationstation/whateverconfigfile
literally set it so anyone can write to the file.
This would be a big security concern in a normal linux system, but for a retropie i wouldn't be too worried. -
other option is to just make sure to turn that
sudo su -
off after you edit that one file you need -
Thanks for the reply. Let me try to explain it better what I am trying to ask. If I edit a file that is "owned" by Pi and use that setting in WinSCP will it change ownership to root or leave the owner as Pi?
I know Buzz had made a comment in another thread that said certain files need to maintain Pi ownership for things to work properly in RetroPie and I was wondering if I edit a file with that option set would it change it to root, something else or leave it as the original owner.
-
@Riverstorm All I can say is that I had some issues editing files like the Pi boot-up config and other essential files. I found that doing it in the command line was too fiddly. I found that solution on the web somewhere and now when I log in with winSCP, it starts with that parameter. I have edited config files about 50 times in the last 10 days across various folders and emulators in RetroPie and it continues to work perfectly. No more access denied errors. Here was the source, the first bit as I recall:
https://blog.jamesbayley.com/2014/01/28/how-to-connect-as-root-using-winscp/
-
@Riverstorm I believe it would recreate the file owned by root. I'd have to test to make sure, but I pretty sure it would.
-
I did a quick test and it seems you can not edit root owned files with that setting. I left "Return code variable" set to the default Autodetect. The file I was testing with:
/boot/config.txt
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.