Bash: kitty_info.txt: Permission denied

Hello.
I accidently type this command ’ echo -e \n\n"~~ kitty_ipsum_2.txt info ~~" >> kitty_info.txt ’ while completing lesson named " Build a Kitty Ipsum Translator" from Relational Database. Since then, whenever I try to redirect any text using echo, the terminal keeps showing “permission denied.”
e.g
command: echo “sdf” >> kitty_info.txt
output: bash: kitty_info.txt: Permission denied

command: echo “random”>> name.txt
output: bash: name.txt: Permission denied

How to grant permission?

# With elevated privileges transfer the ownership of the file to  the current user.
sudo chown $USER kitty_info.txt

# As normal user that owns the file, changes the permissions of the file.
chmod 744 kitty_info.txt

by seeing this it seems that user do not have necessary permission to write on file.
You have to use the chmod command to change the permission.
chmod kitty_info.txt
This command allows you to write on file.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.