I lost my ssd on my pi and had to buy a new one, when installing the lite version of the OS I used the imager tool to create a "pi" user, since it does not do it automatically anymore. But now I can't use mkdir /usb, it says access denied.

"pi@raspberrypi:~ $ mkdir /usb mkdir: cannot create directory ‘/usb’: Permission denied"

I can do it using it sudo mkdir /usb but when I did so I could not get samba permissions on the directory from my Windows machine. Here is the smb.conf:

[HomePi] path = /mnt/usb/Media writeable = yes create mask = 0777 directory mask = 0777 public = no

2 Answers 2


To create a new directory/folder using mkdir, you must have the permissions set by the parent directory/folder. Since you are attempting to create /usb, you must have root permissions because / is not only the parent directory, it is also owned by root.

You may create and use /usb with sudo, but you may be overlooking another directory already created for the purpose of mounting external drives: /mnt. The advantage of using mnt over a directory that you create is that mnt is where externally mounted drives are expected to be found by some utilities and software.

Wrt samba permissions, recall that samba cannot override the permissions set in your file system. To avoid a mess, you should do something like this:

$ sudo mkdir /mnt/myusbdrive
$ sudo chown pi:pi /mnt/myusbdrive 
$ chmod <???> /mnt/myusbdrive  # where <???> are the file system permissions needed to support your Samba permissions; e.g. `744`

I am not sure WHY you would WANT to create such a directory but any under / require root permission.

The pi user had/has passwordless sudo permission but any user (except root) on any Linux OS needs sudo.

  • I'm just a simple user trying to make a media center of a raspberry pi with tutorials I found online. I just would like to create a place for my media and my docker containers, where do you suggest me to create this folders? May 31, 2022 at 22:57
  • @RafaelCarvalho If you have a Question you should ASK it - not something else. DO NOT ask in comments! This is a basic Linux question - not Pi specific, but any question needs to explain what you hope to achieve. Creating a directory ANYWHERE but your HOME needs sudo. Creating a new root directory seems like a BAD idea - I would question the tutorial.
    – Milliways
    Jun 1, 2022 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.