user88
user88

Reputation: 1164

mkdir: cannot create directory `pgsql': Permission denied

I want to create directory like below:

ajs@ajs-HP-Compaq-dc5800-Small-Form-Factor:/usr/local$ mkdir pgsql
mkdir: cannot create directory `pgsql': Permission denied

But I am getting error:

Permission denied

How can I resolve and create directory pgsql in this location /usr/local$

Kindly suggest me, hope for reply.

Thanks

Upvotes: 0

Views: 9554

Answers (3)

pkill
pkill

Reputation: 29

You are getting a Permission denied error because you do not have access rights to create a directory in /usr/local. You can determine the access rights for these directories by using the stat command. The output will look something like this.

$> stat -c '%n %A %G %U' /usr /usr/local
/usr drwxr-xr-x root root
 /usr/local drwxr-xr-x root root

Now double check who you are. You can use the whoami command or the id command invoked below twice to reveal both username and group.

$> id -un; id -gn

In the stat output, root:root owns both /usr and /usr/local and only the owner may create (write) new directories based on the access rights. In order to create the directories, I'd recommend either becoming root or trying the command with sudo. If this is not possible, I'm afraid you'll have to create the directory elsewhere or contact the administrator of that machine.

Upvotes: 1

esp-Jan
esp-Jan

Reputation: 1

You probably have to be root to do such things in /usr/local.

Upvotes: 0

vijayalakshmi d
vijayalakshmi d

Reputation: 726

You have to check your user name to have permission for creating directory in the folder /usr/local$

Check your permission for the folder by the command

ls -ltr /usr

Link to refer about file permissions.

Upvotes: 1

Related Questions