Cannot create directory in tmp(overthewire bandit24)

2.8k Views Asked by At

I'm trying to solve bandit24 on overthe wire on ubuntu virtual machine. I have already seen the solution. But i have a problem,when i try to create a directory on tmp as bandit24@bandit i get this message:

Cannot create directory "name_of_directory": file exists.

If I try with find command there is only the "." directory and with ls I get the message:

Cannot open directory '.' : permission denied.

I also have tried with ls -l on tmp and I get the message:

Cannot open directory 'tmp': Permission denied

What else could I do? What could be the problem?

2

There are 2 best solutions below

0
On
  1. It means that there is a directory under /tmp/ with the same name that you specified. But since you did not create it (in this case, someone created with a different bandit user), you cannot view it. There is not read permission for bandit24 to access it.
  2. Since /tmp/ is directory accessible for all user accounts, you cannot list the files/directories under it without the root permission. (Which means the root of the bandit machine has configured like that)

What you need to do Try a random name. Create anything random under /tmp/. It will work.

1
On

Try to prepend sudo at your command. Seems you don't have permissions to read the /tmp directory, what is pretty weird.

Example that might works:

To list the /tmp contents:

sudo ls -l /tmp

To create the 'my_new_dir' inside /tmp:

sudo mkdir /tmp/my_new_dir