If you created a text file as a root then normal user can't write to it without root access in that case we have to change file permission.
First we have to create a text file as root
use touch to create a file
Now we can see only root user can read and write to it.

To change the permission use
chmod o+w filename

Now we can see that permission is changed.
If you are changing permission of a directory and it has some files in it and you want to change permission of that files also then use.
chmod -R o+w mydir
-R will not only change the permision of directory but it will also change the permission of all files in it.
First we have to create a text file as root
use touch to create a file
Now we can see only root user can read and write to it.

To change the permission use
chmod o+w filename
- u for current user
- g for group
- o for other
- + to add permission
- - to remove permission
- r for read
- w for write
- x for execute
Now we can see that permission is changed.
If you are changing permission of a directory and it has some files in it and you want to change permission of that files also then use.
chmod -R o+w mydir
-R will not only change the permision of directory but it will also change the permission of all files in it.
No comments:
Post a Comment