Error removing file permission denied

I'm trying to remove a big folder from my hard drive, but I get the following error message: Error removing file: Permission denied The "permissions" tab in the directory's properties window says that it has read, write, and execute for owner, user, and group. But it still refuses to be removed. I've tried removing them as root in the terminal, but it doesnt work. I have no idea have chmod works. I am the biggest n00b ever. Help!
  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • New to Ubuntu
  • [ubuntu] Error removing file: Permission denied

  1. Error removing file: Permission denied

    I’m trying to remove a big folder from my hard drive, but I get the following error message:

    Error removing file: Permission denied

    The «permissions» tab in the directory’s properties window says that it has read, write, and execute for owner, user, and group. But it still refuses to be removed. I’ve tried removing them as root in the terminal, but it doesnt work. I have no idea have chmod works.

    I am the biggest n00b ever. Help!


  2. Re: Error removing file: Permission denied

    you need to be very careful when using the following command because you could easily wipe out large sections of your install and easily be forced to do a reinstall from scratch.

    Code:

    sudo rm -rf /path/to/directory/

    Note that if you dont have the permissions to be removing the directory you probably shouldnt be. Take another second to think about what you are doing because you wont be able to undo this.

    Desktop: Q6600 OC: 343 x 9, 4 GB RAM, 8600 GTS Twinview (22″,17″), 1.5 TB RAID 5
    Laptop: Lenovo T61 T7300 @ 2 GHz, 2GB RAM, Nvidia 140M Quadro, 160 GB harddrive
    Remember to mark posts as [SOLVED] when your problem is resolved


  3. Re: Error removing file: Permission denied

    Quote Originally Posted by dascheer
    View Post

    I’m trying to remove a big folder from my hard drive, but I get the following error message:

    Error removing file: Permission denied

    The «permissions» tab in the directory’s properties window says that it has read, write, and execute for owner, user, and group. But it still refuses to be removed. I’ve tried removing them as root in the terminal, but it doesnt work. I have no idea have chmod works.

    I am the biggest n00b ever. Help!

    If you’re extra super sure you want to delete the folder, and everything in it, try this command (delete recursively and force it):

    Code:

    sudo rm -rf folder_name

    Work?

    If not, try this command to set permissions (recursively, everyone can read/write/execute):

    Code:

    sudo chmod -R 777 folder_name

    Then try to delete it again :

    Code:

    sudo rm -rf folder_name

    Still not working?

    Post the results of this command, if not:

    -darc

    EDIT: O yeah, added SUDO to the command I listed, forgot about that, thanks Tamoneya : (

    Last edited by darc; May 7th, 2008 at 08:34 PM.


  4. Re: Error removing file: Permission denied

    run and work graphically if you like


  5. Re: Error removing file: Permission denied

    Thanks for the replies. I can’t find the Trash directory, though. In Gutsy, it was a hidden .Trash directory in the home folder, but I cant find it in Hardy


  6. Re: Error removing file: Permission denied

    Quote Originally Posted by dascheer
    View Post

    Thanks for the replies. I can’t find the Trash directory, though. In Gutsy, it was a hidden .Trash directory in the home folder, but I cant find it in Hardy

    Check here : /home/user/.local/share/Trash

    I don’t have access to my system at the moment to verify, but culled this from another thread.
    -darc

    EDIT: Note that by «user» I mean your username. Or:
    ~/.local/share/Trash

    Last edited by darc; May 7th, 2008 at 08:59 PM.

    Reason: clarification


  7. Re: Error removing file: Permission denied

    Yes! The chmod -R 777 worked perfectly! Thanks a lot guys!


  8. Re: Error removing file: Permission denied

    You could also do it this way (removes all files in the trash)…

    sudo rm -rf ~/.local/share/Trash/files/*


  9. Re: Error removing file: Permission denied

    Quote Originally Posted by fenian
    View Post

    You could also do it this way (removes all files in the trash)…

    Thanks for the info as I ran into the same issue as well. I have a question though as I’m learning various switches to use in terminal. For the command that you listed:

    sudo rm -rf ~/.local/share/Trash/files/*

    I did not see a switch for «-rf». I’m assuming it does a recursive search for any files that are in the specified location & forcibly removes them? Just wondering. Thanks in advance to anyone that can help me with this.


  10. Re: Error removing file: Permission denied

    Thanks!! That worked for me.


Bookmarks

Bookmarks


Posting Permissions

How to delete locked folders/files? When I try to delete them an error occurs: «Error removing file: Permission denied» I am root. See the image below to know what kind of folders/files.

enter image description here

thanks

Henry's user avatar

Henry

3321 silver badge11 bronze badges

asked Mar 23, 2015 at 20:15

Leonardo's user avatar

5

Launch your file explorer as root using:

gksudo nautilus

This will open your file explorer, and grant it root, so it should be able to view/delete the directory/file.

If you are like me, and don’t care about the warnings in this question you can use this instead:

sudo nautilus

Community's user avatar

answered Mar 23, 2015 at 20:21

Henry's user avatar

HenryHenry

3321 silver badge11 bronze badges

7

Try the following: launch Terminal and enter

sudo rm -rf '/path/to/locked/folder'

And be VERY careful with the path to folder!

pomsky's user avatar

pomsky

65.6k20 gold badges228 silver badges241 bronze badges

answered Mar 23, 2015 at 20:20

user300458's user avatar

user300458user300458

2,0882 gold badges16 silver badges20 bronze badges

Steps:

  1. Open Terminal.
  2. Run command:

    sudo su
    
  3. Command above would ask for your password.
  4. Once the correct password is given, you would give following command.

    chmod a+rwx folder/file 
    

    and go to home and just delete the folder/file.

  5. Exit for root user type exit.

pomsky's user avatar

pomsky

65.6k20 gold badges228 silver badges241 bronze badges

answered Oct 24, 2016 at 20:53

Jitendra's user avatar

JitendraJitendra

8276 silver badges6 bronze badges

4

The lock symbol means your user currently have no write permission on the file/folder. To change this:

  1. Check the current owner/group/permissions status by right clicking the file/folder, clicking Properties and then switching to the Permissions tab.
  2. Open a Terminal by hitting Ctrl+Alt+t.
    • If you are the Owner of the file (i.e. the Owner field shows your username): add write permission to the owner by running this command: chmod u+w <path_to_file_folder>
    • If you are not the Owner of the file, but you are in the Group group (i.e. the Group field shows your username or a name of a group to which you belong, e.g. sudo): add write permission to the group by running this command: sudo chmod g+w <path_to_file_folder>
    • If you are not the Owner of the file and you are not in the Group group: add write permission to the others by running this command: sudo chmod o+w <path_to_file_folder>
  3. Run exit

And then just delete the file/folder from Nautilus.

Alternatively:

  1. Open a Terminal by hitting Ctrl+Alt+t.
    • Remove the file/folder as root by running this command: sudo rm -rf <path_to_file_folder>

answered Mar 23, 2015 at 20:29

kos's user avatar

koskos

35k13 gold badges98 silver badges149 bronze badges

Here is something , that I found was easier to do instead of opening terminal. Right-Click the file and open properties. Then switch to the permissions tab. Then wherever it says Access: change it from whatever it is to Create And Delete Files. This should remove the lock and then you can delete the file normally.

answered Jul 5, 2016 at 15:50

Mi Mi's user avatar

Mi MiMi Mi

111 bronze badge


To delete a file or directory, the ownership and permissions are required. Basically the user needs to have write permissions on the file. It doesn’t matter whether this user is owner or part of the group ownership of the file in question. But even this is sometimes not enough, as the following example shows.

Our local user «john» has access to the local /log/dev directory and can successfully list all the files in this path:

john@logserver:/log/dev$ ls -la
total 748
-rw-rw-rw- 1 logstash logstash  20932 Feb  9 11:55 app-dev-2022-02-09-10.log.gz
-rw-rw-rw- 1 logstash logstash  55433 Feb  9 12:38 app-dev-2022-02-09-11.log.gz
-rw-rw-rw- 1 logstash logstash   6679 Feb  9 16:29 app-dev-2022-02-09-15.log.gz
-rw-rw-rw- 1 logstash logstash  26099 Feb  9 17:18 app-dev-2022-02-09-16.log.gz
-rw-rw-rw- 1 logstash logstash  12028 Feb  9 18:07 app-dev-2022-02-09-17.log.gz
-rw-rw-rw- 1 logstash logstash  23340 Feb  9 19:53 app-dev-2022-02-09-18.log.gz
-rw-rw-rw- 1 logstash logstash  62450 Feb  9 20:41 app-dev-2022-02-09-19.log.gz
-rw-rw-rw- 1 logstash logstash 122669 Feb 10 10:55 app-dev-2022-02-10-09.log
-rw-rw-rw- 1 logstash logstash 317346 Feb 10 11:49 app-dev-2022-02-10-10.log
-rw-rw-rw- 1 logstash logstash  94678 Feb 10 12:00 app-dev-2022-02-10-11.log

The write permissions are given, as all these files have read-write permissions for owner, group and others (chmod 666). But as soon as john wants to delete a file, the user gets a permission denied:

john@logserver:/log/dev$ rm app-dev-2022-02-09-10.log.gz
rm: remove regular file ‘app-dev-2022-02-09-10.log.gz’? y
rm: cannot remove ‘app-dev-2022-02-09-10.log.gz’: Permission denied

There are some wrong answers which can be found on the Internet, including hints that «only the owner can delete files». That’s bogus. That’s why the file permissions for others are there in the first place.

Although the file permissions are enough for john to delete the file, there is one more thing to consider: The parent directory. But why?

On this StackExchange question, user jsbillings describes such a situation very well:

Deleting a file means you are making changes to the directory it resides in

By looking at the permissions of the file’s parent directory (/log/dev), we can see that «john» does not have write permissions:

root@logserver:~# ls -la /log/
total 64
drwxrwxrwx  7 logstash root      4096 Feb  9 11:16 .
drwxr-xr-x 20 root     root      4096 Jan 17 15:55 ..
drwxr-xr-x  2 logstash logstash  4096 Feb 10 13:10 dev
drwx——  2 root     root     16384 Jan 17 15:56 lost+found
drwxr-xr-x  2 logstash logstash  4096 Feb  4 11:00 prod
drwxr-xr-x  2 logstash logstash 12288 Feb 10 13:10 stage
drwxr-xr-x  2 logstash logstash 20480 Feb 10 13:10 test

Only the logstash user (directory owner) is allowed to write/modify the dev directory.

Let’s adjust this a bit. We change the group ownership to john (or another group, user john is a member of) and set the write permissions for the group (chmod 775), too:

root@logserver:~# chown logstash:john /log/dev
root@logserver:~# chmod 775 /log/dev
root@logserver:~# ls -la /log/
total 64
drwxrwxrwx  7 logstash root      4096 Feb  9 11:16 .
drwxr-xr-x 20 root     root      4096 Jan 17 15:55 ..
drwxrwxr-x  2 logstash john      4096 Feb 10 13:10 dev
drwx——  2 root     root     16384 Jan 17 15:56 lost+found
drwxr-xr-x  2 logstash logstash  4096 Feb  4 11:00 prod
drwxr-xr-x  2 logstash logstash 12288 Feb 10 13:10 stage
drwxr-xr-x  2 logstash logstash 20480 Feb 10 13:10 test

After this ownership and permission change on the parent directory, user «john» can try to delete the file within /log/dev again:

john@logserver:/log/dev$ rm app-dev-2022-02-09-10.log.gz
rm: remove regular file ‘app-dev-2022-02-09-10.log.gz’? y

No error this time, and the file is gone:

john@logserver:/log/dev$ ls -la
total 624
-rw-rw-rw- 1 logstash logstash  55433 Feb  9 12:38 app-dev-2022-02-09-11.log.gz
-rw-rw-rw- 1 logstash logstash   6679 Feb  9 16:29 app-dev-2022-02-09-15.log.gz
-rw-rw-rw- 1 logstash logstash  26099 Feb  9 17:18 app-dev-2022-02-09-16.log.gz
-rw-rw-rw- 1 logstash logstash  12028 Feb  9 18:07 app-dev-2022-02-09-17.log.gz
-rw-rw-rw- 1 logstash logstash  23340 Feb  9 19:53 app-dev-2022-02-09-18.log.gz
-rw-rw-rw- 1 logstash logstash  62450 Feb  9 20:41 app-dev-2022-02-09-19.log.gz
-rw-rw-rw- 1 logstash logstash  16791 Feb 10 10:55 app-dev-2022-02-10-09.log.gz
-rw-rw-rw- 1 logstash logstash 317346 Feb 10 11:49 app-dev-2022-02-10-10.log
-rw-rw-rw- 1 logstash logstash  94678 Feb 10 12:00 app-dev-2022-02-10-11.log

Add a comment

Show form to leave a comment

Comments (newest first)

ck from Switzerland wrote on Nov 4th, 2022:

Because of the parent directory (/) — or mount point in this case. It also needs write permissions. So you would have to «chmod 777 /» but that’s a bad idea.


Anton from wrote on Nov 3rd, 2022:

Then why

under root
touch /test
chmod 0666 /test
or
chmod 666 /test

under user
rm /test
Permission denied


olly on linux from Hamburg wrote on Sep 12th, 2022:

That’s exactly I just asking myself. So, the reason is the parent Dir .. Thanx a lot!


When you install any programs with root access on Linux-based operating systems, you may receive a Permission Denied error if you try to delete the remaining files or folders, and as a result, you cannot delete the file or folder.

How to Delete Permission Denied File/Folder in Linux

How to Delete an Undeleted File or Folder in Linux

For example, you are using the Linux Mint or Ubuntu operating system, and you have created a new file/folder on the desktop. Since you are logged in to the system with a non-root user, you can easily delete the file/folder you created.

However, in some cases, when you install a program that requires root access, you may encounter files and folders that cannot be deleted anywhere or on the desktop. Therefore, when you try to delete these files and folders normally, you will receive a Permission Denied error.

On Linux, you can use Terminal to delete such files and folders that cannot be deleted. You can delete files that cannot be deleted using the Linux RM command by switching to Root in the Terminal.

How to Remove Files and Folders by Using Terminal on Ubuntu, Debian, Linux Mint, Kali Linux

We will use the Linux RM command to delete an indelible folder that we encountered on Linux Mint 18/19. On Linux, you can delete files, directories, and folders using the RM command.

To delete undelete files on Linux or delete folders, follow the steps below.

   Step 1

As you can see in the image below, there is a folder on Linux Mint that cannot delete. When you try to delete it normally, you will receive a Permission Denied error.

Try to delete the vmware-tools-distrib folder as follows.

vmware-tools-distrib

   Step 2

You will receive a Permission Denied error as in the image below.

Permission Denied Error

   Step 3

Open the Terminal on Linux and execute sudo su to access Root, then type your root password and press Enter.

sudo su

   Step 4

On Linux, you can use the ls command to display the directory in your current location. To delete the undeleted folder, execute rm -rf vmware-tools-distrib.

rm -rf vmware-tools-distrib

rm -rf vmware-tools-distrib

   Step 5

As soon as you execute the rm -rf vmware-tools-distrib command, you can see that the folder has deleted.

Deleting a Folder

Deleting a File That Cannot Be Deleted ⇒ Video

To delete an undeletable file or folder on Linux Mint 18/19, you can watch the video below and also subscribe to our YouTube channel to support us!

   Final Word


In this article, we have examined step by step on how to delete permission denied files or folders. Thanks for following us!

   Related Articles


How to Install SecureCRT
How to Install Wireshark
How to Install Debian in VirtualBox
How to Install Linux Mint in VirtualBox
How to Install Debian in VMware

  • #1

Hi guys,

another problem. A file I sent to the trash won’t delete. I right-click on the file, say «delete from trash» and get an error «permission denied»…

I even tried logging in as root: opened up a terminal, typed sudo su, left the terminal open, and tried to delete the file as I did above. That didn’t work.

Scanned with AVAST. No viruses.

What to do…

-‘Mage

  • #3

Hi caravel,

I just tried that exact command. The file won’t go away. I even tried logging in as sudo su and deleting it, error received is:

«There was an error deleting temp.linux-i686-2.5. Error removing file: permission denied.»

The program these files came from was a botched installation of listen-0.5.

-‘Mage

  • #4

Update on this problem:

buried in the listen-0.5 folder is the build folder, in that is the mmkeys folder. In the mmkeys folder there are these two folders:

lib.linux-i686-2.5
temp.linux-1686-2.5

It’s these two folders that can’t be deleted (even while in sudo su)… Right-clicking on them the «Delete from Trash» option is grayed out. Even trying to change their permissions I get the following error:

«Sorry, couldn’t change the permissions of «temp.linux-i686-2.5″: Operation not supported by backend».. same error for that lib.linux file. Can’t change them even while under sudo su…

What to do??

EDIT: More strangeness… output of rm command:
rm: cannot remove `/root/.Trash/listen-0.5/mmkeys/build/lib.linux-i686-2.5′: No such file or directory
rm: cannot remove `/root/.Trash/listen-0.5/mmkeys/build/temp.linux-i686-2.5′: No such file or directory

Problem is it still shows up that in the trash I have an item (graphically) even though according to this no item exists….

-‘Mage

  • #6

Awesome, that worked!

Thank you!

-‘Mage

When you install any programs with root access in Linux, you may get a Permission Denied error if you try to remove or delete the remaining folders/files. As a result, you will not be able to delete the folder or file. Now, you may need to know how to delete an undeleted folder or file in Linux.

For instance, you are using the Linux Mint/ Ubuntu operating system. Also, you have made a new folder or file on the desktop. Since you are logged in to the system with a non-root user, easily you are able to remove or delete the folder/file you made. But, in other cases, when you install a program that needs root access, you may find the folders and files cannot be removed on the desktop or anywhere.

So, when you try to remove those folders and files, you are going to get a Permission Denied error. On Linux, you are able to use Terminal to remove such folders and files that cannot be removed. You will be able to remove folders that cannot be removed by using the Linux RM command.

Table of Contents on this article below:

  • More info: How to Use Command to Delete File in Linux Terminal

HOW TO DELETE FOLDERS AND FILES BY USING TERMINAL ON LINUX

Now, you are going to use the Linux Rm command to remove a folder. On Linux, you are able to remove files or directories by using the Rm command. To remove folder in Linux, you have to follow these steps below:

Step 1

As you will see, there is a folder in Linux that cannot be removed. When you try to remove it normally, you are going to get a Permission Denied error. Now, try to remove that folder. As we explained before that you are going to get a Permission Denied error.

Step 2

After that, you have to open the Terminal in Linux and run sudo su to access root. Next, you are able to type your root password. Please press Enter.

Step 4

On Linux, you are able to use the Is command to show the directory in your location. To remove an undeleted folder, you have to run rm -rf vmware-tools-distrib.

Step 5

As soon as you run the command, you are able to view that the folder has been removed.

For those who encounter the error Permission Denied While using Linux, you do not worry as it can be solved. Remember that the error is encountered when you do not have the privileges to make edits a file.

Root has access to all folders and files and can make any edits. But, other users may not be allowed to make such edits. For your information, the permissions can be changed by using the chmod keyword.

The syntax for the command is:

chmod flags permissions filename

  • flags are the additional option you can set.
  • permissions define if you can read, write, or execute the file. They are able to be represented by using symbolic (Octal numbers).
  • filename is the name of a file whose permissions are changed.

Here is an instance where you are able to read, write, and execute a file whereas, group and others can only read it.

chmod u=rwx,g=r,o=r file

Each letter has a meaning:

  • r gives read permissions.
  • w gives write permissions.
  • x gives execute permissions .

To change directory permissions in Linux, you are able to use the following command:

  • chmod +rwx filename: To add permissions.
  • chmod -rwx directoryname: To delete permissions.
  • chmod +x filenam: To offer executable permissions.
  • chmod -wxfilename: To pick up write and executable permissions.

For note: “r” is for read, “w” is for write, and “x” is for execute.

HOW TO CHANGE DIRECTORY PERMISSIONS FOR THE GROUP OWNERS IN LINUX

HOW TO CHANGE DIRECTORY PERMISSIONS FOR THE GROUP OWNERS IN LINUX

Actually, the command to change directory permissions for the group owners is similar. However, it add a “g” for the group or “o” for the users:

  • chmod g+w filename
  • chmod g-wx filename
  • chmod o+w filename
  • chmod o-rwx foldername

To change directory permissions for everyone, you are able to use “u” for the users, “g” for the group, “o” for others, and “ugo” or “a” for all.

  • chmod ugo+rwx foldername: To allow read, write, and run to everyone.
  • chmod a=r foldername: To allow only read permission for everyone.

HOW TO CHANGE GROUPS OF DIRECTORIES AND FILES IN LINUX

HOW TO CHANGE GROUPS OF DIRECTORIES AND FILES IN LINUX

By using these commands, you are able to change groups of files and directories in Linux.

  • chgrp groupname filename
  • chgrp groupname foldername

For note: the group has to exit before you are able to assign groups to files and directories

HOW TO CHANGE OWNERSHIP IN LINUX

HOW TO CHANGE OWNERSHIP IN LINUX

Another command is changing ownerships of files and directories in Linux:

chown name filename

chown name foldername

The commands above are going to allow ownership to someone, but all sub files and directories still belong to the original owner.

Also, you are able to combine the group and ownership command by using:

chown -R name:filename /home/name/directoryname

This command provides someone the ownership of the directory files, and all files and subfolders. The -R stands for recursive, that transfers ownership of all sub directories to the new owner.

HOW TO CHANGE PERMISSIONS IN LINUX USING NUMERIC CODE

HOW TO CHANGE PERMISSIONS IN LINUX USING NUMERIC CODE

You may need to learn how to change permissions in numeric code in Linux. To do that, you are able to use numbers instead of “r”, “w”, or “x”.

  • 0 = No Permission
  • 1 = Execute
  • 2 = Write
  • 4 = Read

Usually, you add up the numbers depending on the level of permission you want to give.

Permission numbers are:

0 = —

1 = –x

2 = -w-

3 = -wx

4 = r-

5 = r-x

6 = rw-

7 = rwx

  • Don’t miss: How To Run Linux OS on Windows 10 with The Subsystem Method

For instance:

  • chmod 777 foldername. This is going to give read, write, and run permissions for everyone.
  • chmod 700 foldername. This is going to give read, write, and run permissions for the user only.
  • chmod 327 foldername. This is going to give write and run permission for the user, w (2) for the group, and read, write, and run for the users.

We are able to conclude that there are some options when it comes to permissions. You have an ability to decide usability among users. Even though it may be easier to only give all permission to everyone, it may end up biting you in the end. So, please select wisely.

Alfin Dani

AUTHOR BIO

On my daily job, I am a software engineer, programmer & computer technician. My passion is assembling PC hardware, studying Operating System and all things related to computers technology. I also love to make short films for YouTube as a producer. More at about me…

I’ve couple of files that I cannot remove using rf -Rf command. I’m the owner of those file and the group assigned to those files is also a group my user is in. What’s even weirder is that I can edit their content and I can change the permissions for them, but I can’t move or delete them.

ls -al
total 12
dr-xr-xr-x 3 rayell pg1083760 4096 2010-10-10 10:00 .
drwxr-xr-x 3 rayell pg1083760 4096 2011-09-02 04:33 ..
-rwxrwxrwx 1 rayell pg1083760    0 2011-09-02 06:38 default.settings.php
drwxrwxrwx 2 rayell pg1083760 4096 2011-09-02 04:33 files
-rwxrwxrwx 1 rayell pg1083760    0 2011-09-02 06:38 settings.php


rm -Rf *
rm: cannot remove `default.settings.php': Permission denied
rm: cannot remove directory `files': Permission denied
rm: cannot remove `settings.php': Permission denied

Can anyone tell me what is happening?

Stéphane Gimenez's user avatar

asked Sep 2, 2011 at 13:45

RaYell's user avatar

3

To remove one file you need write permission on the directory that contains¹ this file.

Here the permissions are dr-xr-xr-x 3 rayell pg1083760 4096 2010-10-10 10:00 . So nobody (other than root) can remove files inside this directory. The owner must use chmod first.



1. There are pretty good reasons for that. By ‘removing’ a file with rm, you are in fact trying to unlink it from the directory (hardlinked copies will not be deleted).

answered Sep 2, 2011 at 13:50

Stéphane Gimenez's user avatar

0

Another possible question is attribute

lsattr file

This command will show you attribute of the file
and a file with ‘i’ attribute cannot be modified (and be deleted)

so check your file’s attribute and remove ‘i’ attribute if the attribute is been set

chattr -i file

answered Apr 14, 2016 at 7:22

LJP-TW's user avatar

2

I had the same problem, and chmod alone didn’t do the trick. I first had to change the owner (user and group) of the files I wanted to remove.

sudo chown -hR root:admin dir_to_delete

Explanation:

  • sudo: make sure you have the proper rights
  • chown: Linux command to change owner of a file
  • -hR: change owner of directory and all subdirectories. I found it here.
  • root: name of new user
  • admin: name of new group

I had already changed the modifiers to 777; I don’t know if that was necessary or not.

answered Apr 30, 2015 at 12:52

physicalattraction's user avatar

1

The reason is that the parent directory has chmod 705 or something like that. You can chmod the parent directory by the following command:

chmod -R 777 directory_name

After this, you can remove that directory and the files it contains.

sblair's user avatar

sblair

12.6k6 gold badges47 silver badges77 bronze badges

answered Mar 9, 2012 at 15:22

Tomagen team's user avatar

2

Just for knowledge sake:
I solved it using sudo editing the sudoers file:

Cmnd_Alias MOVE = /bin/mv, /bin/rm
user ALL=(postgres) NOPASSWD:MOVE

In the procedure the user does:sudo -u postgres rm /tmp/test.file

answered May 11, 2022 at 8:34

user169779's user avatar

Понравилась статья? Поделить с друзьями:
  • Error remote target already exists
  • Error remote origin already exists что это
  • Error remote origin already exists что значит
  • Error remote origin already exists переводчик
  • Error referenceerror regeneratorruntime is not defined