Nano edit, permission denied
11,351
While your user may have permission to read the file, your user doesn't have permission to write the file.
Use ls -l <filename>
to list permissions, owner and group of the file.
If appropriate, change permissions or owner so you can write to the file.
How to use the chown
command
chown
changes the user and/or group ownership of for given file. The syntax is:
chown owner-user file
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file
How to use the chmod
command
To setup file permission you need to use chmod
, its syntax is chmod <mode> <filename>
Related videos on Youtube
Author by
Kristin Kohler
Updated on September 18, 2022Comments
-
Kristin Kohler over 1 year
I am trying to edit a index.php by using
sudo nano index.php
.
Nano opens me intoindex.php
, then i add the code into the file, save and try to exit but it sayspermission denied
. I am usingssh
session in terminal and also Amazon web services... I am signed in on an ubuntu@IPADDRESS. any help? -
chili555 over 9 yearsI suggest you edit your answer to include the steps to chown and chmod.
-
becko over 7 yearsthe OP says he used
sudo
. Why ischown/chmod
necessary?