How do I change the ownership of a file in unix?



  • You have to have root priviledges to change the owner of a file or directory that you do not own, for example as root user, to change owner of the file "afile" from unixbod to sysadmin do:

    [root@venus unixbod]# ls -l afile
    -rw-rw-r−− 1 apache unixbod 0 Sep 21 21:46 afile
    [root@venus unixbod]# chown unixbod afile
    [root@venus unixbod]# ls -l afile
    -rw-rw-r−− 1 unixbod unixbod 0 Sep 21 21:46 afile
    

Log in to reply
 

© Lightnetics 2024