简体   繁体   中英

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

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.

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.

您可能必须是root用户才能在/ usr / local中执行此类操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM