How can I edit a readonly file? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
-3
down vote

favorite












We have no privileges to change file permissions. We have no permissions even for super users. How can we edit this file?







share|improve this question














closed as unclear what you're asking by karel, Eric Carvalho, Kevin Bowen, vidarlo, waltinator Apr 27 at 13:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 6




    Copy the file to a writable directory and make your edits there.
    – dsstorefile1
    Apr 26 at 7:41






  • 1




    @dsstorefile and how do they put edited file back in place ?
    – Soren A
    Apr 26 at 8:30










  • What is your real goal? You might be getting an XY problem.
    – Melebius
    Apr 26 at 8:36






  • 1




    That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
    – spaceman117X
    Apr 26 at 10:25














up vote
-3
down vote

favorite












We have no privileges to change file permissions. We have no permissions even for super users. How can we edit this file?







share|improve this question














closed as unclear what you're asking by karel, Eric Carvalho, Kevin Bowen, vidarlo, waltinator Apr 27 at 13:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 6




    Copy the file to a writable directory and make your edits there.
    – dsstorefile1
    Apr 26 at 7:41






  • 1




    @dsstorefile and how do they put edited file back in place ?
    – Soren A
    Apr 26 at 8:30










  • What is your real goal? You might be getting an XY problem.
    – Melebius
    Apr 26 at 8:36






  • 1




    That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
    – spaceman117X
    Apr 26 at 10:25












up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











We have no privileges to change file permissions. We have no permissions even for super users. How can we edit this file?







share|improve this question














We have no privileges to change file permissions. We have no permissions even for super users. How can we edit this file?









share|improve this question













share|improve this question




share|improve this question








edited May 8 at 18:51









Zanna

48k13119227




48k13119227










asked Apr 26 at 7:40









Mayank Sharma

1




1




closed as unclear what you're asking by karel, Eric Carvalho, Kevin Bowen, vidarlo, waltinator Apr 27 at 13:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by karel, Eric Carvalho, Kevin Bowen, vidarlo, waltinator Apr 27 at 13:28


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 6




    Copy the file to a writable directory and make your edits there.
    – dsstorefile1
    Apr 26 at 7:41






  • 1




    @dsstorefile and how do they put edited file back in place ?
    – Soren A
    Apr 26 at 8:30










  • What is your real goal? You might be getting an XY problem.
    – Melebius
    Apr 26 at 8:36






  • 1




    That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
    – spaceman117X
    Apr 26 at 10:25












  • 6




    Copy the file to a writable directory and make your edits there.
    – dsstorefile1
    Apr 26 at 7:41






  • 1




    @dsstorefile and how do they put edited file back in place ?
    – Soren A
    Apr 26 at 8:30










  • What is your real goal? You might be getting an XY problem.
    – Melebius
    Apr 26 at 8:36






  • 1




    That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
    – spaceman117X
    Apr 26 at 10:25







6




6




Copy the file to a writable directory and make your edits there.
– dsstorefile1
Apr 26 at 7:41




Copy the file to a writable directory and make your edits there.
– dsstorefile1
Apr 26 at 7:41




1




1




@dsstorefile and how do they put edited file back in place ?
– Soren A
Apr 26 at 8:30




@dsstorefile and how do they put edited file back in place ?
– Soren A
Apr 26 at 8:30












What is your real goal? You might be getting an XY problem.
– Melebius
Apr 26 at 8:36




What is your real goal? You might be getting an XY problem.
– Melebius
Apr 26 at 8:36




1




1




That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
– spaceman117X
Apr 26 at 10:25




That is the purpose of permissions, to prevent unauthorized users to read/write/execute. Only solution that I see is possible is to boot the system from USB drive and to edit that file. But if the file/drive is encrypted there is no way you can do it.
– spaceman117X
Apr 26 at 10:25










1 Answer
1






active

oldest

votes

















up vote
1
down vote













As pointed out by dsstorefile, you can copy the contents of the file to another file for which you have writing rights, and then edit the writable file.



Then you can put the edited file back in place by deleting the original file and copying your new file at the same place.



In more detail:



Using command-line / terminal



If you can create files in the directory where your file is



If the original read-only file is called original.csv
and you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > data.csv


and now you can open and edit the data.csv file.



Once the editing is done,



rm original.csv


When asked if you want to delete the read-only file, answer y



mv data.csv original.csv


If your file is in a directory you cannot write to



If /path/to/writable/dir/ is the name of a directory you can write to, if the original read-only file is called original.csv
and if you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > /path/to/writable/dir/data.csv


and now you can open and edit the data.csv file in /path/to/writable/dir/. In this situation, you won't be able to put your modified file where the original file was.



Without using terminal



  • Open your csv with a text editor, for example gedit .

  • Copy all the content of the file, for example with Ctrl+A Ctrl+C

  • Create a new file within the editor

  • Paste the contents of the csv, for example with Ctrl+V

  • Save your new file with a name that ends with .csv

  • delete the original file

  • move the edited file where the original file was, and rename it if necessary





share|improve this answer






















  • What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
    – Melebius
    Apr 26 at 8:47






  • 1




    cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
    – Jack B.
    Apr 26 at 8:50











  • For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
    – dsstorefile1
    Apr 26 at 8:52






  • 2




    “cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
    – Melebius
    Apr 26 at 8:57










  • Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
    – Jack B.
    Apr 26 at 9:04

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













As pointed out by dsstorefile, you can copy the contents of the file to another file for which you have writing rights, and then edit the writable file.



Then you can put the edited file back in place by deleting the original file and copying your new file at the same place.



In more detail:



Using command-line / terminal



If you can create files in the directory where your file is



If the original read-only file is called original.csv
and you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > data.csv


and now you can open and edit the data.csv file.



Once the editing is done,



rm original.csv


When asked if you want to delete the read-only file, answer y



mv data.csv original.csv


If your file is in a directory you cannot write to



If /path/to/writable/dir/ is the name of a directory you can write to, if the original read-only file is called original.csv
and if you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > /path/to/writable/dir/data.csv


and now you can open and edit the data.csv file in /path/to/writable/dir/. In this situation, you won't be able to put your modified file where the original file was.



Without using terminal



  • Open your csv with a text editor, for example gedit .

  • Copy all the content of the file, for example with Ctrl+A Ctrl+C

  • Create a new file within the editor

  • Paste the contents of the csv, for example with Ctrl+V

  • Save your new file with a name that ends with .csv

  • delete the original file

  • move the edited file where the original file was, and rename it if necessary





share|improve this answer






















  • What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
    – Melebius
    Apr 26 at 8:47






  • 1




    cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
    – Jack B.
    Apr 26 at 8:50











  • For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
    – dsstorefile1
    Apr 26 at 8:52






  • 2




    “cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
    – Melebius
    Apr 26 at 8:57










  • Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
    – Jack B.
    Apr 26 at 9:04














up vote
1
down vote













As pointed out by dsstorefile, you can copy the contents of the file to another file for which you have writing rights, and then edit the writable file.



Then you can put the edited file back in place by deleting the original file and copying your new file at the same place.



In more detail:



Using command-line / terminal



If you can create files in the directory where your file is



If the original read-only file is called original.csv
and you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > data.csv


and now you can open and edit the data.csv file.



Once the editing is done,



rm original.csv


When asked if you want to delete the read-only file, answer y



mv data.csv original.csv


If your file is in a directory you cannot write to



If /path/to/writable/dir/ is the name of a directory you can write to, if the original read-only file is called original.csv
and if you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > /path/to/writable/dir/data.csv


and now you can open and edit the data.csv file in /path/to/writable/dir/. In this situation, you won't be able to put your modified file where the original file was.



Without using terminal



  • Open your csv with a text editor, for example gedit .

  • Copy all the content of the file, for example with Ctrl+A Ctrl+C

  • Create a new file within the editor

  • Paste the contents of the csv, for example with Ctrl+V

  • Save your new file with a name that ends with .csv

  • delete the original file

  • move the edited file where the original file was, and rename it if necessary





share|improve this answer






















  • What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
    – Melebius
    Apr 26 at 8:47






  • 1




    cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
    – Jack B.
    Apr 26 at 8:50











  • For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
    – dsstorefile1
    Apr 26 at 8:52






  • 2




    “cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
    – Melebius
    Apr 26 at 8:57










  • Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
    – Jack B.
    Apr 26 at 9:04












up vote
1
down vote










up vote
1
down vote









As pointed out by dsstorefile, you can copy the contents of the file to another file for which you have writing rights, and then edit the writable file.



Then you can put the edited file back in place by deleting the original file and copying your new file at the same place.



In more detail:



Using command-line / terminal



If you can create files in the directory where your file is



If the original read-only file is called original.csv
and you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > data.csv


and now you can open and edit the data.csv file.



Once the editing is done,



rm original.csv


When asked if you want to delete the read-only file, answer y



mv data.csv original.csv


If your file is in a directory you cannot write to



If /path/to/writable/dir/ is the name of a directory you can write to, if the original read-only file is called original.csv
and if you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > /path/to/writable/dir/data.csv


and now you can open and edit the data.csv file in /path/to/writable/dir/. In this situation, you won't be able to put your modified file where the original file was.



Without using terminal



  • Open your csv with a text editor, for example gedit .

  • Copy all the content of the file, for example with Ctrl+A Ctrl+C

  • Create a new file within the editor

  • Paste the contents of the csv, for example with Ctrl+V

  • Save your new file with a name that ends with .csv

  • delete the original file

  • move the edited file where the original file was, and rename it if necessary





share|improve this answer














As pointed out by dsstorefile, you can copy the contents of the file to another file for which you have writing rights, and then edit the writable file.



Then you can put the edited file back in place by deleting the original file and copying your new file at the same place.



In more detail:



Using command-line / terminal



If you can create files in the directory where your file is



If the original read-only file is called original.csv
and you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > data.csv


and now you can open and edit the data.csv file.



Once the editing is done,



rm original.csv


When asked if you want to delete the read-only file, answer y



mv data.csv original.csv


If your file is in a directory you cannot write to



If /path/to/writable/dir/ is the name of a directory you can write to, if the original read-only file is called original.csv
and if you want your writable file to be called data.csv, you can open a terminal, go to the directory where your file is, and run the command:



cat original.csv > /path/to/writable/dir/data.csv


and now you can open and edit the data.csv file in /path/to/writable/dir/. In this situation, you won't be able to put your modified file where the original file was.



Without using terminal



  • Open your csv with a text editor, for example gedit .

  • Copy all the content of the file, for example with Ctrl+A Ctrl+C

  • Create a new file within the editor

  • Paste the contents of the csv, for example with Ctrl+V

  • Save your new file with a name that ends with .csv

  • delete the original file

  • move the edited file where the original file was, and rename it if necessary






share|improve this answer














share|improve this answer



share|improve this answer








edited May 8 at 18:56









Zanna

48k13119227




48k13119227










answered Apr 26 at 8:43









Jack B.

385




385











  • What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
    – Melebius
    Apr 26 at 8:47






  • 1




    cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
    – Jack B.
    Apr 26 at 8:50











  • For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
    – dsstorefile1
    Apr 26 at 8:52






  • 2




    “cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
    – Melebius
    Apr 26 at 8:57










  • Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
    – Jack B.
    Apr 26 at 9:04
















  • What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
    – Melebius
    Apr 26 at 8:47






  • 1




    cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
    – Jack B.
    Apr 26 at 8:50











  • For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
    – dsstorefile1
    Apr 26 at 8:52






  • 2




    “cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
    – Melebius
    Apr 26 at 8:57










  • Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
    – Jack B.
    Apr 26 at 9:04















What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
– Melebius
Apr 26 at 8:47




What are the reasons for using cat (main purpose: concatenation of files) instead of cp (copy command)?
– Melebius
Apr 26 at 8:47




1




1




cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
– Jack B.
Apr 26 at 8:50





cp will preserve the rights, so the result will be read-only as well. cat will create a new file, with the default rights; so a file you can write to, in most cases
– Jack B.
Apr 26 at 8:50













For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
– dsstorefile1
Apr 26 at 8:52




For the first part of the answer an alternate method of editing the read-only file would be to use :w! with vi/m.
– dsstorefile1
Apr 26 at 8:52




2




2




“cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
– Melebius
Apr 26 at 8:57




“cp will preserve the rights” There are parameters to control this but I agree, cat could be simpler. (Even when compared with editors as suggested by @dsstorefile.)
– Melebius
Apr 26 at 8:57












Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
– Jack B.
Apr 26 at 9:04




Indeed, you can change the behaviour of cp, for example with the --no-preserve option. I wasn't aware of it; thank you :)
– Jack B.
Apr 26 at 9:04


Popular posts from this blog

How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

Trouble downloading packages list due to a “Hash sum mismatch” error

How do I move numbers in filenames, in a batch renaming operation?