Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help4407


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
 
Options:
RSS cloud
Jump to:

sed changing rw to r permissions on files in WSL

1 of 390 articles shown, currently no other people reading this forum.
photo
From: Maktoom A.
Date: Thu 21st May 2020, 11:38pm
Actions: 
        Login-to-reply

 

"Alastair Haldane" <22*6*3*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> I'm in WSL and experiencing an issue with sed - with -i to edit inline and overwrite 
> the file ( I believe it does this by creating a temp file initially...) the 
> permissions of the file in question change from rw to read only. Is this normal 
> behaviour? 
> 
> example for "testfile" (rw permissions): sed -i "s/cat/dog/" testfile
> returns 
> "preserving permissions for 'tempfilename......"
> now, "testfile" has read only permissions. 

There's a few things. One, make sure you don't already have the file open i.e. some other program is using the file. 

Otherwise, its likely caused by the Windows Security Settings. Make sure your user has Full Control on the folder, this can be done in the Properties > Security tab. 

Related articles

sed changing rw to r permissions on files in WSL (all 7) RSS
├─ original   Thu 21st May 2020, 9:55pm, Alastair H.
├─ THIS   Thu 21st May 2020, 11:38pm, Maktoom A.
├─ reply 2   Fri 22nd May 2020, 5:12am, Alastair H.  O.P.
├─ reply 3   Fri 22nd May 2020, 8:11am, Christopher M.
├─ reply 4   Fri 22nd May 2020, 8:29am, Lee dB.
├─ reply 5   Fri 22nd May 2020, 9:53am, Alastair H.  O.P.
└─ reply 6   Fri 22nd May 2020, 9:55am, Christopher M.
This Page


Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020