Change permissions for a symbolic link

u123

I have a symlink with these permissions:

lrwxrwxrwx 1 myuser myuser       38 Aug 18 00:36 npm -> ../lib/node_modules/npm/bin/npm-cli.js*

The symlink is located in a .tar.gz archive. Now when I unpack the tar.gz archive using maven the symlink is no longer valid. I'm therefore trying to reconstruct the symlink. First I create the symlink using ln but how do I set the same permissions as the original symlink?

user26112

You can make a new symlink and move it to the location of the old link.

ln -s <new_location> npm2
mv -f npm2 npm

That will preserve the link ownership. Alternatively, you can use chown to set the link's ownership manually.

chown -h myuser:myuser npm

On most systems, symlink permissions don't matter. When using the symlink, the permissions of the components of symlink's target will be checked. However, on some systems they do matter. MacOS requires read permission on the link for readlink, and NetBSD's symperm mount option forces link permissions checks on read and traversal. On those systems (and their relatives, including FreeBSD and OpenBSD) there is a equivalent -h option to chmod.

chmod -h 777 npm

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Symbolic link permissions don't change with chmod

분류에서Dev

Why permission denied upon symbolic link update to new target with permissions OK?

분류에서Dev

failed to create symbolic link

분류에서Dev

Disk usage of a symbolic link

분류에서Dev

Disk usage of a symbolic link

분류에서Dev

Failed to create a symbolic link

분류에서Dev

Executable symbolic link file not working

분류에서Dev

symbolic link to a directory and relative path

분류에서Dev

How to properly create symbolic link?

분류에서Dev

Using symbolic link in Windows XP

분류에서Dev

Why is /etc/localtime a symbolic link?

분류에서Dev

Create Symbolic Link as Regular user

분류에서Dev

Replace symbolic link which linked to directory target

분류에서Dev

How can I break a symbolic link loop?

분류에서Dev

Symbolic link not allowed in Apache2

분류에서Dev

Install rpm and put file into symbolic link directory

분류에서Dev

Change permissions of users and groups?

분류에서Dev

Can GNU Stow use a stow directory that is a symbolic link?

분류에서Dev

Shell script file existence test fails for broken symbolic link

분류에서Dev

Move files from one location to another in Linux using Symbolic link

분류에서Dev

get original from a folder which is alias and symbolic link to another folder

분류에서Dev

/usr/lib/libgraph.so.1 is not a symbolic link

분류에서Dev

How to get full path of original file of a soft symbolic link?

분류에서Dev

Is this a correct way to test whether symbolic link has /proc/ directory

분류에서Dev

What is the right way to remove that symbolic link in Ubuntu 15.10?

분류에서Dev

Can I replace a program folder with a symbolic link to another drive?

분류에서Dev

Change permissions upon uploading with scp

분류에서Dev

Change Folder & File Permissions for all Subdirectories

분류에서Dev

How to change the permissions of multiple liferay articles

Related 관련 기사

  1. 1

    Symbolic link permissions don't change with chmod

  2. 2

    Why permission denied upon symbolic link update to new target with permissions OK?

  3. 3

    failed to create symbolic link

  4. 4

    Disk usage of a symbolic link

  5. 5

    Disk usage of a symbolic link

  6. 6

    Failed to create a symbolic link

  7. 7

    Executable symbolic link file not working

  8. 8

    symbolic link to a directory and relative path

  9. 9

    How to properly create symbolic link?

  10. 10

    Using symbolic link in Windows XP

  11. 11

    Why is /etc/localtime a symbolic link?

  12. 12

    Create Symbolic Link as Regular user

  13. 13

    Replace symbolic link which linked to directory target

  14. 14

    How can I break a symbolic link loop?

  15. 15

    Symbolic link not allowed in Apache2

  16. 16

    Install rpm and put file into symbolic link directory

  17. 17

    Change permissions of users and groups?

  18. 18

    Can GNU Stow use a stow directory that is a symbolic link?

  19. 19

    Shell script file existence test fails for broken symbolic link

  20. 20

    Move files from one location to another in Linux using Symbolic link

  21. 21

    get original from a folder which is alias and symbolic link to another folder

  22. 22

    /usr/lib/libgraph.so.1 is not a symbolic link

  23. 23

    How to get full path of original file of a soft symbolic link?

  24. 24

    Is this a correct way to test whether symbolic link has /proc/ directory

  25. 25

    What is the right way to remove that symbolic link in Ubuntu 15.10?

  26. 26

    Can I replace a program folder with a symbolic link to another drive?

  27. 27

    Change permissions upon uploading with scp

  28. 28

    Change Folder & File Permissions for all Subdirectories

  29. 29

    How to change the permissions of multiple liferay articles

뜨겁다태그

보관