The folder structure is: /home/bobuser/ftp/files
I am logged in as root, and have taken ownership of /bobuser, /ftp and /files. I have 777 permissions on all folders. There is nothing inside /files.
When I'm inside /files and do ls -a I get
. .. When I do
lsof +D /home/bobuser/ftp/files I get this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME bash 1479 root cwd DIR 253,1 4096 256003 /home/bobuser/ftp/files lsof 2080 root cwd DIR 253,1 4096 256003 /home/bobuser/ftp/files lsof 2081 root cwd DIR 253,1 4096 256003 /home/bobuser/ftp/files If I try to kill service 2080 or 2081 (kill -9 2081) it tells me service doesn't exist. Those two PID numbers change every time I run the same command. If I kill 1479 it kills my SSH session as user and I'm logged out.
In fact I want to delete /bobuser and everything below.
EDIT:
More output as requested by comments:
Logged in with root user and changed directory to root, even though I was there already.
root@myhost:~# cd /root Running this next line returns nothing. I only get a response if I'm cd'ed into the files directory, then I get the output as posted above.
root@myhost:~# lsof +D /home/bobuser/ftp/files Tried this line next and return is 0
root@myhost:~# ls -l /home/bobuser/ftp/files total 0 102 Answers
Short answer:
umount /home/bobuser/ftp/files rm -r /home/bobuser/ftp/files If you take a look at the FD section of lsof man page, you will find out that cwd means current working directory.
The other thing you mentioned is different PIDs for 2nd and 3rd lines. Those are the PIDs of lsof command, so every time you run lsof, it will run with a new PID and then it will be closed.
After changing your directory to /root, we can see that there is no open file under /home/uerbob/ftp/files directory, so my first guess is that some partition is mounted there.
You should run below command to see if any partitions are mounted there:
mount | grep -i bobuser/ftp If yes, you will get an output like this:
/dev/vda1 on /home/bobuser/ftp/files type ext4 (rw,relatime,data=ordered) Then simply unmount the partition and remove the directory.
0Sometimes the folder is not mounted, so the umount command will not work.
I have used for this kind of undeletable folders this command as user not even root:
sudo rm -r /mnt/hdd/movies/folder-problem