japoowf
japoowf

Reputation: 49

How to create a directory without root permission?

I am trying to create a directory on the server through a mina-deployer script but the shell shows Permission denied.

The command is:

mkdir -p /monit && chown ubuntu: /monit && chmod u+w . /monit

And the error is:

Mkdir: unable to create directory "/ monit": Permission denied

queue 'echo "-----> Create Monit dir"'
queue echo_cmd "mkdir -p #{config_path}/monit && chown #{user}:#{group} #{config_path}/monit && chmod u+w . #{config_path}/monit"

Upvotes: 1

Views: 7838

Answers (1)

Andrew Marshall
Andrew Marshall

Reputation: 96994

If you don’t have permission then you don’t have permission. You can either:

  • Create the file elsewhere.
  • Run the command as a different user (via sudo, su, or logging in as them) who does have the appropriate permission.
  • Adjust the permissions of the enclosing directory (but take care doing so, as / and other places have their permissions as-is for good reason).

Upvotes: 3

Related Questions