Mkdir: cannot create directory `/home/phpmy/html': Permission denied centos

for incompatibility installation problems, I've decided to reinstall Centos 6.3

as can be seem from the df output, I've partitioned both / and and /home directories

[oracle@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda8              12G  5.3G  6.5G  45% /
tmpfs                 3.8G  1.2M  3.8G   1% /dev/shm
/dev/sda6             190M  144M   37M  80% /boot
/dev/sda12            178G  112G   57G  67% /home
/dev/sda9             4.0G  408M  3.4G  11% /tmp
/dev/sda13             18G  4.2G   13G  25% /u01
/dev/sda10            4.0G  1.7G  2.1G  46% /u02
/dev/sda11            5.0G  693M  4.0G  15% /u03

any reinstall will not remove /home directories provided correct reinstall options are provided

upon reinstall when I login as phpmy and make a directory, I encountered the following error.

[phpmy@localhost ~]$ mkdir -p /home/phpmy/html
mkdir: cannot create directory `/home/phpmy/html': Permission denied
[phpmy@localhost ~]$ 

here's my directory details

[root@localhost ~]# ls -dalh /
drwxr-xr-x. 30 root root 4.0K Apr 30 22:23 /
[root@localhost ~]# ls -dalh /home
drwxr-xr-x. 10 root root 4.0K Apr 30 23:55 /home
[root@localhost ~]# ls -dalh /home/phpmy/
drwxr-xr-x. 9 504 504 4.0K Apr 27 23:53 /home/phpmy/
[root@localhost ~]# ls -dalh /home/oracle
drwx------. 65 oracle oracle 4.0K Apr 30 23:30 /home/oracle

so what should I do to resolve the above issue?

thanks a lot!

There's no guarantee that upon a system reinstallation UIDs remain the same.

Whatever user that used to belong to UID 504 apparently no longer matches its new UID.

You can chown -R your home dir, or modify the UID in /etc/passwd.

1 Like

yes you are right I need to do a chown phpmy:phpmy /home/phpmy.

thanks