Zeydz
Posts: 1
Joined: Tue Jun 25, 2019 1:17 pm

Permission Denied, can't move, delete or save files.

Tue Jun 25, 2019 1:23 pm

Hello

So I just got finished creating my minecraft server on the raspberry pi 3, with the Raspbian OS. I tried to add plugins and such to my minecraft server, but everytime I try to move the plugin file, it says "Permission denied". I don't know what to do. I've tried to edit some text files in my minecraft folder aswell, but that doesn't work aswell. I have no idea how to fix this, so I made this post for help.

Thank you for any answers.

klricks
Posts: 7155
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Permission Denied, can't move, delete or save files.

Wed Jun 26, 2019 3:26 am

Zeydz wrote:
Tue Jun 25, 2019 1:23 pm
Hello

So I just got finished creating my minecraft server on the raspberry pi 3, with the Raspbian OS. I tried to add plugins and such to my minecraft server, but everytime I try to move the plugin file, it says "Permission denied". I don't know what to do. I've tried to edit some text files in my minecraft folder aswell, but that doesn't work aswell. I have no idea how to fix this, so I made this post for help.

Thank you for any answers.
In order to modify any files that are not in the users home directory (/home/pi/........) you must prefix the command with sudo

Code: Select all

sudo mv old new
For example to use the nano editor with root privileges:

Code: Select all

sudo nano file_name
Or to use the GUI editor, first open lxterminal then:

Code: Select all

sudo leafpad
Or filemanager:

Code: Select all

sudo pcmanfm
You should NOT however use sudo when editing and especially not when creating files in the user home folders.
If do then the file will be owned by root instead of pi. This can give you trouble later on.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
thagrol
Posts: 3094
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Permission Denied, can't move, delete or save files.

Wed Jun 26, 2019 12:44 pm

klricks wrote:
Wed Jun 26, 2019 3:26 am
In order to modify any files that are not in the users home directory (/home/pi/........) you must prefix the command with sudo
That's an incredibly insecure suggestion and will bypass all permissions set by the file's owner.

It'll work but you really shouldn't do this. Use it on the wrong files or in the wrong directory and you can easily break your system.

It's far better to understand and configure file and directory permissions than to brute force them with sudo. Getting the permissions and ownership you want may also mean you need to edit mount options for the storage.

It's also hard to do "sudo ..." in the GUI file manager.

If you want to see why using sudo for this is bad, consider these commands (don't run them, you'll trash your system):

Code: Select all

rm -rf /
sudo rm -rf /
One will fail, one will delete everything. Or

Code: Select all

rm *
sudo rm *
In the wrong directory the first will fail but the second will go ahead and delete everything.

This is made worse on raspbian as the default configuartion doesn't prompt for a password when sudo is used so there's no chance to realise your mistake before it's too late.

As for the OP's problem. It's hard to suggest reasonable solutions without more information. Such as the output of

Code: Select all

ls -l
on the files to be moved and both the source and target directories.
Arguing with strangers on the internet since 1993.

Lexieye
Posts: 5
Joined: Thu May 28, 2020 10:48 pm

Re: Permission Denied, can't move, delete or save files.

Thu Jun 25, 2020 3:05 pm

you can create a ROOT user like on windows GUI (logout) login to that root user and you will have full r/w of the gui

Watch video
This guy is a G

https://m.youtube.com/watch?v=v0vrkMP27PA

swampdog
Posts: 380
Joined: Fri Dec 04, 2015 11:22 am

Re: Permission Denied, can't move, delete or save files.

Thu Jun 25, 2020 3:36 pm

I only got 44 seconds into that video and there's already two mistakes. It goes downhill from there with an unnecessary vim trick to allow root ssh login. Nobody do anything advised in that video.

User avatar
thagrol
Posts: 3094
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Permission Denied, can't move, delete or save files.

Thu Jun 25, 2020 4:59 pm

Lexieye wrote:
Thu Jun 25, 2020 3:05 pm
you can create a ROOT user like on windows GUI (logout) login to that root user and you will have full r/w of the gui

Watch video
This guy is a G

https://m.youtube.com/watch?v=v0vrkMP27PA
That's bad for so many reasons. Not least of which is an incorrect and four year old tutorial.

And it doesn't "create a ROOT user" it just gives the existing "root" user a password and changes the ssh config which has nothing to do with running the desktop.
Arguing with strangers on the internet since 1993.

bjtheone
Posts: 863
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Permission Denied, can't move, delete or save files.

Tue Jun 30, 2020 3:25 pm

Lexieye wrote:
Thu Jun 25, 2020 3:05 pm
you can create a ROOT user like on windows GUI (logout) login to that root user and you will have full r/w of the gui
One of the KEY points of Linux is that it is a multiuser operating system, with a robust permission systems that allows for different levels of file access. In this system "root" is the god user with powers to do anything to any part of the file system. There are very good reasons use a normal user (like "pi") does not have nor need write privileges throughout the file system. If you are trying to do something as user:pi and don't have privileges, this is a very big clue that what you are doing is potentially ill advised and may break the system if you persist. Using "sudo" as a giant stick will just hide all the warnings away. Certainly root access is necessary when doing some administrative operations, but you should be very clear on what is going to happen when you run the command.

Getting into the habit of either running as a root user or prefacing all your commands with sudo will provide concrete examples of why this is bad, sooner or later, and will provide opportunities to reflect on why backups are good and allow you to practice reinstalling the operating system.

There are no training wheels or safety nets when running as root. If you issue a command that deletes/changes/overwrites files or entire partitions it will do so. An amusing and illuminating thing to do sometime is to delete the running operating system ("rm -rf /" run as root) and see how far it gets before crashing.

Return to “Raspberry Pi OS”