LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-20-2011, 11:55 AM   #1
tliggins
LQ Newbie
 
Registered: May 2006
Location: Virginia
Distribution: Fedora/Cent OS/Ubuntu
Posts: 7

Rep: Reputation: 0
Symbolic Links Permissions Unique Problem!


I hope this is the correct place to post this request.
Is it possible to change permissions on symbolic links using the c programming language or any other for that matter? Now, I know what you are thinking, so let me provide some background. I know permission are meaningless. I know that typically permissions are set to 777.
The project that I am working on does the following. On HPUX systems, a c binary recreates missing links from a stored image of the filesystem, if they are missing. The problem is that the permissions are 700 when the links are restored (should be 777). The c method to restore the symbolic links is "symlink()" which takes as its argument the target and linkname. The client wants 777 on the links. I do not know why the permissions are different.
I would like to know if I can change permissions on the link by code, changing the mode?
Is this a bug somewhere in HPUX 10,x and 11.x os or "symlink" c library method, who knows? There are groups of nodes running HPUX, for example groupA, groupB etc. The problems appears in groupA but not in groupB. Seems the nodes are configured differently. While I would love to know if this is a configuration issue, it appears that way to me, there would be little I could do about it. Politics you know, but that's okay, in time someone would listen. Any input either way would be appreciated.

Thanks TL
 
Old 02-20-2011, 02:07 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,541

Rep: Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878
It's not possible to change the permissions on a symbolic link and it shouldn't be possible to create a symlink with less than 777 permissions, this sounds like a bug.
Quote:
If the path given to chmod() contains a symbolic link as the last
element, this link is traversed and path name resolution continues.
chmod() changes the access mode of the symbolic link's target, rather
than the access mode of the link.

chmod(2)
 
Old 02-21-2011, 01:56 AM   #3
tliggins
LQ Newbie
 
Registered: May 2006
Location: Virginia
Distribution: Fedora/Cent OS/Ubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for the quick response “ntubski”!

Agreed, one should not be able to / cannot change the permissions on symbolic links.
I have searched for days to determine if the link permissions could be reset to its default value of 777 by creating a program to do it. This simply does not appear to be the case.
I can surmise that the system kernel has the ultimate say when it comes to permissions and symbolic links, correct? If there is any supporting documentation (POSIX) available stating this to be the definitive case please point me in their direction. There are a number of high ranking IT people (programmers and system admins) that believe this can be done. I would need to convince them otherwise.

From what I have read, BSD and some flavors of HPUX have the ability (lchmod)to change permissions on the symbolic links themselves. The permissions are still ignored and do not matter. I would think that this must be supported by THEIR operating system kernels and are non POSIX compliant on this matter.

Thanks again,
TL
 
Old 02-21-2011, 12:30 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,541

Rep: Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878
I searched around for lchmod and it looks like it's an undocumented system call on HPUX, so I suppose you can just try writing a program to use it and see if it works.
 
  


Reply

Tags
hpux, permissions, symlink


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Unique problem. Has to do with permissions jadacyrus Linux - Server 5 07-07-2009 12:41 PM
symbolic links directories access and permissions goncalopp Linux - Security 2 05-07-2009 01:28 PM
Httpd problem : symbolic links not followed chamu Linux - Server 7 05-28-2007 09:59 AM
Problem with Apache and Symbolic Links gjagadish Linux - Security 1 08-12-2006 04:24 AM
symbolic links and permissions jcai Linux - Newbie 2 06-09-2006 04:37 PM


All times are GMT -5. The time now is 02:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration