Set file permissions and ownership rights in Linux or Ubuntu

Linux Terminal commands file permission.
Linux Terminal with file permission commands in Ubuntu.

File permissions and ownership rights of files is a bit complicated, if you never had any problems with it before. Very often it is necessary to change file permissions from old USB hard drives or some folders with many files.

Here is the fastest and most convenient solution :

Open the Linux Terminal dialog in the folder that contains the necessary files where you want to change the ownership and the permissions. Most graphical file managers allow to open the Terminal command line dialog from the right click menu in any folder. Let's use the /media folder for external media in Ubuntu Linux as an example.

Set the ownership properties with the following command:

sudo chown -R -v USER-NAME:users /media

The sudo command will give super user permissions of the root to the chown program.

The chown program will change ownership.

The -R option will force recursive change for all files and all folders that are in the target folder.

The -v option will display the changes, the progress and any possible problems.

The USER-NAME:users option will set the USER-NAME from the group of users as the owner of the files.

The /media is the name of the folder for external memory and media devices in Ubuntu Linux.

Now, Set the file permissions with the following command:

sudo chmod -R -c u=rwX,go=rX /media

The sudo command will give super user permissions of the root to the chmod program.

The chmod program will set or change file permissions.

The -R option will force recursive change for all files and all folders that are in the target folder.

The -c option will display all the changes and progress.

The u=rwX will set the file owner permissions to read, write and with capital X for the read-access of folder content.

The go=rX will set the group (g) and the other's (o) permissions to read only and with capital X for folder viewing.

The /media is the name of the folder for external memory and all external media (CD,DVD,USB Drives) in Ubuntu Linux.

epSos.de is hoping that you understand this quick method now. You actually just need to know the user name, the root password and the name of the folder for the change of the file permissions and ownership. Use the two lines of commands as you want, just change the user name and the folder name and you are perfectly set for basic personal needs.

This method is better than other methods, because it helps you to understand the errors, the speed and the progress of the process. The graphical software or programs with buttons do not show the progress as good as the commands in the Linux Terminal. Very often the graphical programs do have issues and forget to set file permissions properly, but this is often not displayed to the users. So you are more safe to use the command line programs in the Linux Terminal in this case. It is more secure and more responsive once you understand the little option letters of the commands.

Good luck and remember to support the Linux movement !!!

☰ ♡ ☼ ⚙ ⇡

Be happy. Talk with people.

🐦 Share on Twitter...

Share on Linked-in...

FB Share on Facebook...

Thank you for sharing !

website logo