Write Protection

How to remove write protection in Ubuntu, this prompts as i create a .py file in a seperate directory??
I had to remove the file using the command: sudo rm telegram_alert.py in ‘temp_alert’ file but even after creating another .py file the same problem arises…leading me with no option but to erase everything!

How to remove this Write Protection??

When i write something, this error msg prompts below and also cannot save it after writing…

Could you tell me where you’re trying to create this file i.e, the directory. You shouldn’t write in a directory that is not allocated to you as the user.
If you’re in the root directory, you should return back to home.

cd ~

If you’re in the correct directory such as home(~) or in one of its subdirectories and still face this issue, you may try this.

chmod a+rw filename.py

Also, if possible attach a screenshot of the output of both these commands

ls -l

Hello @pankajkumar.p,
Here is the screenshot of the results of the above three commands,

Also, when i created another directory named ‘tempalert’,
No write permission was showed unlike the previous directory named ‘temp_alert’
Actually this write protection started to show up not from the start as you can see that I’ve created a file named ‘conf.py’… I am doubtful as to what made this error to show up suddenly!!

Hi @tvmukhil, the following commands should help.


This command should tell you the current working directory. Pretty much all your personal files in the home directory should allow you to read, write and execute the files.
To return to home directory you may use

cd  ~

One good way to check the file permissions is thus

ls -l

This shows the file permissions of all the files in your pwd.
To add read and write permissions to a file, you may use

sudo chmod a+rw filename.py

if you are the root user.