System Administration

Change ownership of simbolic link

 
SOLVED
Go to solution
Dewa Negara_4
Regular Advisor

Change ownership of simbolic link

Hi All,

I want to change the ownership of simbolic link on one of our UNIX servers. How can we change the ownership of simbolic links below from root:system to root:security?

lrwxrwxrwx 1 root system 32 Mar 05 22:26 mkuser.default -> /usr/lib/security/mkuser.default
lrwxrwxrwx 1 root system 28 Mar 03 05:49 mkuser.sys -> /usr/lib/security/mkuser.sys
lrwxrwxrwx 1 root system 22 Mar 03 05:49 scan -> /usr/lib/security/scan

Please help. High score will be given.

Thanks and Best Regards,
Dewa
Santos
4 REPLIES 4
Rajeev  Shukla
Honored Contributor
Solution

Re: Change ownership of simbolic link

Hi Dewa,

You cant change the group or user of a soft link file after you have created. To get what you want you need to change the effective uid or gid to what you want your symbolic (soft) link file to be. (where as you can do it with hard link).

Ok now back to what you want.
remove the soft link files first.
Then run newgrp security
this will change your group to security and user remains root and then create the soft link again.
You'll have the ownersip as you want.
Let me know if its not clear i'll post with an example.

Cheers
Rajeev
Senthil Prabu.S_1
Trusted Contributor

Re: Change ownership of simbolic link

Hi,
you can use "chown" with following option "`--no-dereference'", on all unix machines.

Or, use the option "-h" with chown, this option will change ownership of symbolic link only.


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Senthil Prabu.S_1
Trusted Contributor

Re: Change ownership of simbolic link

Hi Dewa,
More infos;

lchown is the system call used to change the ownership of symbolic link.

More info at;
http://www.gsp.com/cgi-bin/man.cgi?section=7&topic=symlink

http://www.gnu.org/software/coreutils/manual/html_chapter/coreutils_13.html


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Dewa Negara_4
Regular Advisor

Re: Change ownership of simbolic link

Hi All,

Thanks alot. I really appriciate it.

Ii got the answer. It works well.

Thanks again.

Best Regards,
Dewa
Santos