Is it possible to change the permissions for the symbolic link?

I am trying to change the permissions for the symbolic link.

Making directory and symbolic link

As how you can see in the image, the soft link has 777 permissions, but i would like to change that.

I tried to change that by:

  1. chmod 755 someLink - but this changes linked directory (someDir) permission.
  2. chmod -h 755 someLink - this brings eroor chmod: invalid option --'h'

Is there a way how to change symbolic link permissions? I am on Ubuntu 18.04

Many thanks in advance

5

1 Answer

While not an exact duplicate, this answer should provide a hint:

$ ls -l
total 0
-rw-r--r-- 1 vidarlo users 0 May 21 19:10 a
lrwxrwxrwx 1 vidarlo users 1 May 21 19:10 b -> a
$ chmod 755 b
$ ls -la
-rwxr-xr-x 1 vidarlo users 0 May 21 19:10 a
lrwxrwxrwx 1 vidarlo users 1 May 21 19:10 b -> a

In short: symlinks does not have permissions. Anyone can read where the symlink points to. The permissions of the target determines the access.

As Rinzwind points out, the -h flag is for *BSD versions of chmod. It does not work on GNU versions of chmod.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like