Mehdi Razvi Mehdi Razvi - 11 months ago 81
Linux Question

How to set folders permissions in linux?

I am supposed to give write/edit permission to my directory in /var/lib/mysql/dbname via Linux.

I am unaware of backend UI and i know i just enetered the text "sudu so" @ centos machine which displays :
[root@ip-10-0-0-61 centos]#

Can anyone tell how to proceed further as I have always been using WinScp which restricts me to write database files due to present set permissions.

Any user interface file manager that could do this would be really helpful too.
Thanks in advance

Answer Source

There are two things to look at, setting permissions, and ownership.

To do this for an entire directory (be careful with this)

chmod -R {permissions} {directory}

If you're unsure what permissions to use check this guide

To set ownership, use

chown {user:group} {directory} -R

Again be careful with these settings. It's not often you'll want an entire directory full of files to all have the same permissions, and you could be opening yourself up to risks if you do so. Always be explicit and give each file the minimum permissions needed to get the job done.