Get a free website with any plan

See how
LINUX AND SSH

Creating folders with mkdir

Last updated

IN SHORT

Run mkdir over SSH to create a new directory inside your Flashcloud hosting account. The command works across Linux distributions to add single, multiple, or nested directories. Add the -p flag when creating folder paths to generate missing parent folders automatically and prevent script errors if the target directory already exists.

Use mkdir foldername to create a new directory in your current location. Run it over SSH from your account. The only real difference between shared hosting and a VPS is who owns the files underneath it and whether you have root to fix permissions when something goes wrong.

This is standard Linux behavior, not a Flashcloud-specific tool, so the same commands work identically across distributions.

Basic usage

From your home directory or any folder you have write access to:

mkdir project-files

This creates project-files inside whatever directory you're currently in. Check where that is first with pwd, and check what's already there with ls.

To create more than one folder at once, list them separated by spaces:

mkdir images css js

Creating nested folders

If you try to create a folder inside a path that doesn't exist yet, mkdir fails:

mkdir projects/2026/website
mkdir: cannot create directory 'projects/2026/website': No such file or directory

Add the -p flag to create every missing folder in the path at once:

mkdir -p projects/2026/website

-p also makes the command safe to re-run. Without it, trying to create a folder that already exists throws an error and can stop a script. With -p, mkdir does nothing and exits normally if the folder is already there.

Setting permissions when you create the folder

By default, new folders inherit permissions based on your shell's umask, usually resulting in 755 (owner can read/write/execute, everyone else can read and execute). You can set specific permissions at creation time with -m:

mkdir -m 750 private-uploads

This is useful for folders that shouldn't be world-readable, like ones holding user uploads or config files. You can always adjust permissions afterward with chmod if you didn't set them at creation.

Where this runs on shared hosting vs VPS

On shared hosting, you don't have root, so you can only create directories inside your own account's space, and you don't need to.

On a VPS, you typically have root access. With that comes responsibility: if you create a folder that your web server process needs to read from, you'll need to set ownership with chown so the server user can access it. A folder created with restrictive permissions will cause silent 403 or 500 errors for a web app trying to read from it, since the OS-level access control is on you on a VPS.

Common errors

  • Permission denied: you're trying to create a folder somewhere your user doesn't own. On shared hosting, make sure you're inside your own home directory tree. On a VPS, either switch to root with sudo or fix ownership of the parent folder.
  • File exists: something with that name is already there, possibly a file rather than a folder. Check with ls -la before overwriting anything.
  • No such file or directory: a parent folder in your path doesn't exist yet. Use -p as described above.

If you're on shared hosting and getting permission errors inside what should be your own account, or you're not sure whether a directory issue is a permissions problem or something on our end, open a ticket from the portal. Support is real people, and they can check server-side ownership and permissions directly.

Common questions

Why do I get a no such file or directory error?

A parent folder in your path does not exist yet. Add the -p flag to your command to create every missing folder in the path at once.

Can I make more than one folder at a time?

Yes. Pass multiple folder names separated by spaces, such as mkdir images css js. The command creates all listed folders in your current directory.

Why does mkdir say permission denied?

You are trying to write inside a directory your user does not own. On shared hosting, confirm you are inside your home directory tree. On a VPS, use sudo to switch to root or correct the ownership on the parent folder.

Why is my site showing a 403 error after adding a folder on my VPS?

The web server user lacks permission to access the folder. Use chown to set the correct server ownership on the directory. You can also inspect and update access rights with chmod.

CAN'T FIND IT?

Real humans answer fast.

Hosting with us? Open a ticket and a real person replies - no scripts, no upsells. Still choosing a host? The same team is included with every plan, from day one.