- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Permission on Symbolic links
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
09-12-2005 04:08 PM
09-12-2005 04:08 PM
Permission on Symbolic links
Can you anyone clarify why we get lrwxrwxrwx when a symbolic is created ? Is it depends on umask value ?
Thanks,
Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 04:19 PM
09-12-2005 04:19 PM
Re: Permission on Symbolic links
Also perms on links do not matter, as long as they have atleast read and file to which it points have right perms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 04:30 PM
09-12-2005 04:30 PM
Re: Permission on Symbolic links
In your situation, any and all users will be able to access the area being linked to. They may (hopefully) not be able to do anything if unauthorized by permissions after that.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 04:31 PM
09-12-2005 04:31 PM
Re: Permission on Symbolic links
Thank you, can you please expand a bit on how umask decides the permission. I just wanted to know a solid reason for getting lrwxrwxrwx.
Thanks,
Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 04:54 PM
09-12-2005 04:54 PM
Re: Permission on Symbolic links
Say I set umask of 000, then resulting files will be as follows.
-rw-rw-rw- 1 root sys 0 Sep 13 10:21 /tmp/test
What is does is as follows.
subtract umask from 666 - for files
subtract umask from 777 - for dirs
so with umask of 00, files will have 777 perms.
In your case, looks that some changed perms to 777. (perms on link can be changed with perms to 777.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 06:21 PM
09-12-2005 06:21 PM
Re: Permission on Symbolic links
default file permission: -rw-rw-rw
default dir permission: -rwxrwxrwx
if you apply umkas of 022
access permissions of the new file created would be = 666 - 022 = 644 (rw-r--r--)
for dir = 777 - 022 = 755 (rwxr-xr-x)
If you need to set an executable bit from a shell created file, you must issue an explicit chmod after first creating the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 06:28 PM
09-12-2005 06:28 PM
Re: Permission on Symbolic links
# umask -S
u=rwx,g=rwx,o=rwx
# umask
00
#
# ln -s test.c link
# ls -l
total 16
lrwxrwxrwx 1 root sys 6 Sep 13 00:17 link -> test.c
-rw-rw-rw- 1 root sys 3 Sep 13 00:16 test.c
# umask 002
# umask -S
u=rwx,g=rwx,o=rx
# rm link
# ln -s test.c link
# ls -l
total 16
lrwxrwxr-x 1 root sys 6 Sep 13 00:18 link -> test.c
-rw-rw-rw- 1 root sys 3 Sep 13 00:16 test.c
When you change umask value, file permission is changed.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 06:30 PM
09-12-2005 06:30 PM
Re: Permission on Symbolic links
{
umask=022
file=666
symlink to a file = 666-022 = 644
}
The above logic is wrong in symlink. Correct me if i am wrong.
--Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 07:17 PM
09-12-2005 07:17 PM
Re: Permission on Symbolic links
To make it more clear....
Files are created with default permission as "666" and directories as "777".
Now umask default value is "022" so files and directories gets created with "644" and "755" respectively.
This happens as "777-022=755" and "666-022=644".
umask is substratcted from the default permissions of the files/directories.
So umask can control the default values of permission for files/directories being created.
You can change umask to have any permissions.
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 07:21 PM
09-12-2005 07:21 PM
Re: Permission on Symbolic links
links is special file :)
it take permission from original file.
if original files is
700
your link will take
700
but you will see 777 if you use ls -la.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 07:24 PM
09-12-2005 07:24 PM
Re: Permission on Symbolic links
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 07:39 PM
09-12-2005 07:39 PM
Re: Permission on Symbolic links
If it is getting created as 777 then your umask value while creating sym link is 000.
Hard link is irresptive of umask and depends on file permission.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 08:18 PM
09-12-2005 08:18 PM
Re: Permission on Symbolic links
Permissions on a symbolic link doesn't really mean anything. You can not change the permissions of the symbolic link ( It will be like lrwxrwxrwx). If you attempt to chmod a symlink, you'll actually change the permissions on the file being pointed to.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 08:24 PM
09-12-2005 08:24 PM
Re: Permission on Symbolic links
If u worked on HP-UX means, Refer the following link:
http://www.unix.com/showpost.php?p=73792&postcount=5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 08:29 PM
09-12-2005 08:29 PM
Re: Permission on Symbolic links
# ls -la
lrwxr-xr-x 1 root sys 10 Sep 13 10:26 gorj -> /home/gorj
# lchmod 777 gorj
# ll
lrwxrwxrwx 1 root sys 10 Sep 13 10:26 gorj -> /home/gorj
attached lchmod.
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 09:29 PM
09-12-2005 09:29 PM
Re: Permission on Symbolic links
The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's actions are determined by the last one specified.
Options
-H If the -R option is specified, symbolic links on the command line are followed. Symbolic links encountered in the tree traversal are not followed.
-L If the -R option is specified, both symbolic links on the command line and symbolic links encountered in the tree traversal are followed.
-P If the -R option is specified, no symbolic links are followed.
-R If file designates a directory, chmod changes the mode of each file in the entire subtree connected at that point.
-h Do not follow symbolic links.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 10:22 PM
09-12-2005 10:22 PM
Re: Permission on Symbolic links
1) hard link (forcible links)
2) soft link
When ever, a new file or directory is creating in forcible manner then it will get same file permission, ownership from source file / directory
# ls -l
total 16
-rw-rw-rw- 1 root sys 3 Sep 13 04:09 source
#
# ln -f source link
# ls -l
total 32
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 link
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 source
Symbolic links are following umask setting for directory generally (666). A symbolic file or directory will not contain any file contents. It is link to source. It is using with default directory umask setting.
You can get this from the following,
# umask 22
# mkdir hi
# ls -l
total 32
drwxr-xr-x 2 root sys 96 Sep 13 04:12 hi
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 link
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 source
# ln -s source link2
# ls -l
total 32
drwxr-xr-x 2 root sys 96 Sep 13 04:12 hi
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 link
lrwxr-xr-x 1 root sys 6 Sep 13 04:13 link2 -> source
-rw-rw-rw- 2 root sys 3 Sep 13 04:09 source
#
hi directory and new symbolic file link2 is using same permission setting.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2005 11:19 PM
09-12-2005 11:19 PM
Re: Permission on Symbolic links
1. Hard links
it is one file with two names.
if you change permission on any name you will change permission on all name /this is in reality the same file/
you create this link
ln source link
2. Soft link
you create new file that point to source file.
you can not change permission on source using link. they are different files.
you create soft link using
ln -s source link
and your link will take permission from source but you will see 777 that is decision
by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 12:00 AM
09-13-2005 12:00 AM
Re: Permission on Symbolic links
Since the permission bits are a posix requirement for any file they must be specified in any case, therefore most systems adopt 777 for this purpose.
However, on HP-UX umask affects the permissions of the created symbolic link, but they still does not affect access rights to the original file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 03:20 AM
09-13-2005 03:20 AM
Re: Permission on Symbolic links
e.g.
# touch file
# umask 000
# ln -s file link1
# umask 002
# ln -s file link2
# umask 022
# ln -s file link3
# umask 222
# ln -s file link4
# ll link*
should give
lrwxrwxrwx 1 root sys 4 Sep 13 16:22 link1 -> file
lrwxrwxr-x 1 root sys 4 Sep 13 16:22 link2 -> file
lrwxr-xr-x 1 root sys 4 Sep 13 16:22 link3 -> file
lr-xr-xr-x 1 root sys 4 Sep 13 16:22 link4 -> file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 03:33 AM
09-13-2005 03:33 AM
Re: Permission on Symbolic links
If you are really concerned about the mode of symlinks (and the mode is ignored; only the mode of the object pointed to matters), there is a way to change them using the undocumented lchmod() system call. Compile the attached code like this:
cc -o lchmod lchmod.c
Use it like this:
lchmod 1666 symlink1 symlink2 ...
It only understand octal modes (what you refer to as permissions) but could be modified to understand symbolic modes. That is left as a student exercise (I don't feel inclined to use those stupid symbolic values). This code is intentionally done in K&R C so that even the Bundled C compiler will process it but could be converted to ANSI syntax in well under 1 minute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 09:32 AM
09-13-2005 09:32 AM
Re: Permission on Symbolic links
http://www.unix.com/showpost.php?p=73792&postcount=5
It gives an excellent overview of symlinks, both historical and from several flavors of Unix. It puts the HP-UX behavior into perspective.
Bill Hassell, sysadmin