Operating System - HP-UX
1833712 Members
2018 Online
110063 Solutions
New Discussion

Re: setting sticky bit on symlink??

 
SOLVED
Go to solution
Norman Dignard
Regular Advisor

setting sticky bit on symlink??

I accidentically deleted symlinks /bin and /lib in the root dir and am trying to recreate them with the same permissions.

Both symlinks had lr_xr_x_r_t The targets themselves /usr/bin and /usr/lib have r_xr_xr_x.

Even if I set the sticky bit on /usr/bin, the symlink does not inherit it. So how do I recreate these symlinks with thier proper permissions?

Regards
NormDignard
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: setting sticky bit on symlink??

The mode of a symbolic link doesn't matter; however, if this really bugs you there is an undocumented system call, lchmod(), which behaves exactly as it's chmod() counterpart except that it acts on symbolic links.

Compile the attached C code. It's intentionally written in K&R C so that even the Bundled C compiler will compile it although it would take less than 30 seconds to make the ANSI changes.

Compile it like this:
cc lchmod.c -o lchmod

execute it like this:
lchmod 1775 symlink1 symlink2 ...

This guy only understands octal file modes but it you want to enhance to understand symbolic modes then knock yourself out.

If it ain't broke, I can fix that.
Norman Dignard
Regular Advisor

Re: setting sticky bit on symlink??

Used lchmod