Can't write to a file with open-world write accessIs it possible to change the permissions for the symbolic link?Unable to access second hdd. ubuntu 12.04can't access the user accountCreating disk images as a normal userApplications see but dont have permission to write to Partition (can't see folders in partition)Why isn't chmod doing what I want it to?Why am I getting this message when I try to create an empty project in Sequelize CLI?Why my .rules pmount USB stick on a BBB, but without write permissions for $USER?Utils installed using snap unable to write to .bashrcAfter Ubuntu 19.04 update, sudo fails, Terminal and File app won't startPermission denied for /usr/bin/gpg2 for Enigmail

Does a code snippet compile? Or does it get compiled?

multiplying two array in python3.7

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

Can the ground attached to neutral fool a receptacle tester?

What is the maximum number of PC-controlled undead?

Can a fight scene, component-wise, be too complex and complicated?

Can you castle with a "ghost" rook?

What should I call bands of armed men in Medieval Times?

Is refreshing multiple times a test case for web applications?

Is there a standardised way to check fake news?

The equation of motion for a scalar field in curved spacetime in terms of the covariant derivative

Tikzpicture - finish drawing a curved line for a cake slice

Plausibility of Ice Eaters in the Arctic

How to avoid the "need" to learn more before conducting research?

constant evaluation when using differential equations.

Why is transplanting a specific intact brain impossible if it is generally possible?

How many different ways are there to checkmate in the early game?

Bitcoin successfully deducted on sender wallet but did not reach receiver wallet

try/finally with bash shell

What is the difference between 型 and 形?

What happen to those who died but not from the snap?

Email address etiquette - Which address should I use to contact professors?

How does "Te vas a cansar" mean "You're going to get tired"?

function evaluation - I don't get it



Can't write to a file with open-world write access


Is it possible to change the permissions for the symbolic link?Unable to access second hdd. ubuntu 12.04can't access the user accountCreating disk images as a normal userApplications see but dont have permission to write to Partition (can't see folders in partition)Why isn't chmod doing what I want it to?Why am I getting this message when I try to create an empty project in Sequelize CLI?Why my .rules pmount USB stick on a BBB, but without write permissions for $USER?Utils installed using snap unable to write to .bashrcAfter Ubuntu 19.04 update, sudo fails, Terminal and File app won't startPermission denied for /usr/bin/gpg2 for Enigmail






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I found the /etc/alternatives/awk file, and when I got a long list of it's details I got:



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Jan 22 2017 /etc/alternatives/awk -> /usr/bin/gawk*


So it's a link and has write access to others, so I tried this:



$ echo hi > /etc/alternatives/awk
bash: /etc/alternatives/awk: Permission denied


And then:



$ cp /bin/ls /etc/alternatives/awk
cp: unwritable '/etc/alternatives/awk' (mode 0755, rwxr-xr-x); try anyway? y
cp: cannot create regular file '/etc/alternatives/awk': Permission denied


How is that possible?



I know I'm a normal user, but I have write access to this file!










share|improve this question



















  • 4





    Possible duplicate of Is it possible to change the permissions for the symbolic link?

    – vidarlo
    Jul 31 at 10:04






  • 2





    @vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

    – Mohammad Kholghi
    Jul 31 at 18:57

















4















I found the /etc/alternatives/awk file, and when I got a long list of it's details I got:



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Jan 22 2017 /etc/alternatives/awk -> /usr/bin/gawk*


So it's a link and has write access to others, so I tried this:



$ echo hi > /etc/alternatives/awk
bash: /etc/alternatives/awk: Permission denied


And then:



$ cp /bin/ls /etc/alternatives/awk
cp: unwritable '/etc/alternatives/awk' (mode 0755, rwxr-xr-x); try anyway? y
cp: cannot create regular file '/etc/alternatives/awk': Permission denied


How is that possible?



I know I'm a normal user, but I have write access to this file!










share|improve this question



















  • 4





    Possible duplicate of Is it possible to change the permissions for the symbolic link?

    – vidarlo
    Jul 31 at 10:04






  • 2





    @vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

    – Mohammad Kholghi
    Jul 31 at 18:57













4












4








4








I found the /etc/alternatives/awk file, and when I got a long list of it's details I got:



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Jan 22 2017 /etc/alternatives/awk -> /usr/bin/gawk*


So it's a link and has write access to others, so I tried this:



$ echo hi > /etc/alternatives/awk
bash: /etc/alternatives/awk: Permission denied


And then:



$ cp /bin/ls /etc/alternatives/awk
cp: unwritable '/etc/alternatives/awk' (mode 0755, rwxr-xr-x); try anyway? y
cp: cannot create regular file '/etc/alternatives/awk': Permission denied


How is that possible?



I know I'm a normal user, but I have write access to this file!










share|improve this question














I found the /etc/alternatives/awk file, and when I got a long list of it's details I got:



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Jan 22 2017 /etc/alternatives/awk -> /usr/bin/gawk*


So it's a link and has write access to others, so I tried this:



$ echo hi > /etc/alternatives/awk
bash: /etc/alternatives/awk: Permission denied


And then:



$ cp /bin/ls /etc/alternatives/awk
cp: unwritable '/etc/alternatives/awk' (mode 0755, rwxr-xr-x); try anyway? y
cp: cannot create regular file '/etc/alternatives/awk': Permission denied


How is that possible?



I know I'm a normal user, but I have write access to this file!







bash permissions symbolic-link






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 31 at 9:06









Mohammad KholghiMohammad Kholghi

3112 silver badges12 bronze badges




3112 silver badges12 bronze badges










  • 4





    Possible duplicate of Is it possible to change the permissions for the symbolic link?

    – vidarlo
    Jul 31 at 10:04






  • 2





    @vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

    – Mohammad Kholghi
    Jul 31 at 18:57












  • 4





    Possible duplicate of Is it possible to change the permissions for the symbolic link?

    – vidarlo
    Jul 31 at 10:04






  • 2





    @vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

    – Mohammad Kholghi
    Jul 31 at 18:57







4




4





Possible duplicate of Is it possible to change the permissions for the symbolic link?

– vidarlo
Jul 31 at 10:04





Possible duplicate of Is it possible to change the permissions for the symbolic link?

– vidarlo
Jul 31 at 10:04




2




2





@vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

– Mohammad Kholghi
Jul 31 at 18:57





@vidarlo my question was not about "how to change a symbolic link permission", it was about "i can't change a file permission", then I understood because it is a sym-link and it points to another file owned by root.

– Mohammad Kholghi
Jul 31 at 18:57










1 Answer
1






active

oldest

votes


















8














No, you don't have permissions to write to the file. It's the symbolic link which has rwx-permissions for everyone, but you don't write to the link, you write to the file the link points to.



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Apr 28 2018 /etc/alternatives/awk -> /usr/bin/gawk


You can see the link points to /usr/bin/gawk, so look at it's permissions:



$ ls -l /usr/bin/gawk
-rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk


/user/bin/gawk is owned by root and only root has write permissions,
that's why you get Permission denied.






share|improve this answer




















  • 1





    Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

    – PerlDuck
    Jul 31 at 9:33






  • 3





    Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

    – PerlDuck
    Jul 31 at 9:43













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1162336%2fcant-write-to-a-file-with-open-world-write-access%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









8














No, you don't have permissions to write to the file. It's the symbolic link which has rwx-permissions for everyone, but you don't write to the link, you write to the file the link points to.



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Apr 28 2018 /etc/alternatives/awk -> /usr/bin/gawk


You can see the link points to /usr/bin/gawk, so look at it's permissions:



$ ls -l /usr/bin/gawk
-rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk


/user/bin/gawk is owned by root and only root has write permissions,
that's why you get Permission denied.






share|improve this answer




















  • 1





    Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

    – PerlDuck
    Jul 31 at 9:33






  • 3





    Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

    – PerlDuck
    Jul 31 at 9:43















8














No, you don't have permissions to write to the file. It's the symbolic link which has rwx-permissions for everyone, but you don't write to the link, you write to the file the link points to.



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Apr 28 2018 /etc/alternatives/awk -> /usr/bin/gawk


You can see the link points to /usr/bin/gawk, so look at it's permissions:



$ ls -l /usr/bin/gawk
-rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk


/user/bin/gawk is owned by root and only root has write permissions,
that's why you get Permission denied.






share|improve this answer




















  • 1





    Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

    – PerlDuck
    Jul 31 at 9:33






  • 3





    Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

    – PerlDuck
    Jul 31 at 9:43













8












8








8







No, you don't have permissions to write to the file. It's the symbolic link which has rwx-permissions for everyone, but you don't write to the link, you write to the file the link points to.



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Apr 28 2018 /etc/alternatives/awk -> /usr/bin/gawk


You can see the link points to /usr/bin/gawk, so look at it's permissions:



$ ls -l /usr/bin/gawk
-rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk


/user/bin/gawk is owned by root and only root has write permissions,
that's why you get Permission denied.






share|improve this answer













No, you don't have permissions to write to the file. It's the symbolic link which has rwx-permissions for everyone, but you don't write to the link, you write to the file the link points to.



$ ls -l /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Apr 28 2018 /etc/alternatives/awk -> /usr/bin/gawk


You can see the link points to /usr/bin/gawk, so look at it's permissions:



$ ls -l /usr/bin/gawk
-rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk


/user/bin/gawk is owned by root and only root has write permissions,
that's why you get Permission denied.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 31 at 9:30









mook765mook765

5,6062 gold badges15 silver badges36 bronze badges




5,6062 gold badges15 silver badges36 bronze badges










  • 1





    Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

    – PerlDuck
    Jul 31 at 9:33






  • 3





    Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

    – PerlDuck
    Jul 31 at 9:43












  • 1





    Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

    – PerlDuck
    Jul 31 at 9:33






  • 3





    Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

    – PerlDuck
    Jul 31 at 9:43







1




1





Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

– PerlDuck
Jul 31 at 9:33





Yes. Symlinks always have 777 but that's not considered anyways when accessing the underlying file. Only the permissions and ownership of the target matter.

– PerlDuck
Jul 31 at 9:33




3




3





Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

– PerlDuck
Jul 31 at 9:43





Also try ls -l -L /etc/alternatives/awk to directly see the information of the target (size, ownership, ...) instead of of the symlink.

– PerlDuck
Jul 31 at 9:43

















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1162336%2fcant-write-to-a-file-with-open-world-write-access%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form