- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- chown for symlinks
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:01 AM
05-30-2002 02:01 AM
chown for symlinks
I have the directory below which is a sym-link:
lrwxrwxrwx 1 cleaw oper .... perl->../perl
I would like to change the ownership of both the link and also the source i.e ../perl. I had tried doing the following:
# chown -h root perl
but it changes only the ownership of the sym-link, and not that of the file/directory pointed to by the symlink.
#ls -l
lrwxrwxrwx 1 root oper .... perl->../perl
I executed chown as root.
Could someone tell me how I could also change the file/dir i.e ../perl pointed to by the symlink perl?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:05 AM
05-30-2002 02:05 AM
Re: chown for symlinks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:10 AM
05-30-2002 02:10 AM
Re: chown for symlinks
From man chown
Options :chown and chgrp recognize the following options:
-h Change the owner or group of a symbolic link.
By default, the owner or group of the target file that a symbolic link points to is changed. With -h, the target file that the symbolic link points to is not affected. If the target file is a directory, and you specify -h and -R,recursion does not take place.
Thus you will never be able to do the two together.
steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:20 AM
05-30-2002 02:20 AM
Re: chown for symlinks
'chown -h' does *not* affect the target file to which the symbolic link points. The man pages are quite clear on this.
Remember that neither the mode nor the ownership of a symbolic link matters. It is the mode and ownership of the file or directory to which the link points that's important.
Thus, if you want to change the ownership of your perl file, 'whown' the file, not the link.
If you want for cosmetic reasons to 'chown' both, use 'chown' with and without the '-h' option, appropriately.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:26 AM
05-30-2002 02:26 AM
Re: chown for symlinks
I tried chown as:
#chown root perl
chown:perl: A file or directory in the path name does not exists.
Any ideas on solving this error?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 02:41 AM
05-30-2002 02:41 AM
Re: chown for symlinks
"chown root ../perl"
Try that.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 05:03 AM
05-30-2002 05:03 AM
Re: chown for symlinks
i addition you might want ot use the "-L" option to "ls", i.e. "ls -lL" to see the *real* (=working) permissions...
Just my $0.02,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 06:50 AM
05-30-2002 06:50 AM
Re: chown for symlinks
Just wondering if you got your answer.
Assuming perl is a symlink pointing to ../perl
"chown -h root perl" will change the owner of the symlink "perl" to root
"chown root perl" will change the owner of the file "perl" points to (in this case "../perl") to root. It is effectively the same as doing "chown root ../perl".
If "chown root perl" says the file doesn't exist, it is referring to "../perl". Does ../perl actually exist?
Darrell