I'm trying to change the user/group of a symbolic link with the command:

$ chown -h myuser:mygroup mysymbolic/

But it's not changing. I'm logged in as root. The current user/group is set to root:root. What went wrong?

link|improve this question
Which operating system do you use?Acoording to the manaul page,-h option takes affect only on systems that can change the ownership of symbolic link. – Jichao Nov 9 '09 at 13:09
feedback

migrated from stackoverflow.com Nov 10 '09 at 21:50

This question came from our site for professional and enthusiast programmers.

4 Answers

I was putting a slash in the end of target:

chown -h myuser:mygroup mysymbolic/

just removed the slash in the end and works.

link|improve this answer
doesn't work for me on ubuntu – Radek Sep 25 '10 at 1:07
Wow, this took me hours to find. – Dustin Fineout Apr 19 '11 at 11:36
feedback

I've tried this myself and it works for me. If you have the -h it changes the owner of the symbolic link, but if you dont then it changes the owner of the file itself and not the link.

But it doesnt seem to work of the symbolic link is linked to a directory

link|improve this answer
feedback

Is the target a file or a directory?

If it is a directory then try -H (upper case H)

link|improve this answer
the target is a directory – rizidoro Nov 9 '09 at 13:09
see my edited reply about directory – Michael Nov 9 '09 at 13:13
Sorry for the thread necromancy, but I'd like to point out that the correct syntax is with the lowercase 'h'. – user40379 Jun 18 '10 at 14:07
feedback

Recreate that link by myuser at myuser's home, and mv this link to the target location by sudo.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown