my files' permissions changed after a backup and new install

7 réponses [Dernière contribution]
muhammed
Hors ligne
A rejoint: 04/13/2013

I backed up my work, and then installed Trisquel Mini. I returned my backed up work to my computer. When I tried to edit files, I could not. I cecked the files with right click --> properties --> permissions. The permissions (for all the files that I have checked so far) are now:

View content: Anyone
Change content: Nobody
Execute: Nobody

I have changed the "Change content" permission to "Anyone", one by one, as I work on my files. Is this okay? Is it possible to change all my files' permission in one go (instead of individually)?

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

You backed up your files by simply copying them to a FAT filesystem, didn't you? That filesystem does not support permissions (anybody can do anything). Trisquel includes Deja Dup for backup. It is an excellent solution. Very easy to use. Features users usually want are there by default: incremental updates, compressed backups, integration with the GNOME's file manager, automatic deletion of the oldest backups when space is missing, etc.

The terminal is handy to add the read permission to anyone on all the file in the directory and inside subdirectories, etc. From inside the restored directory:
$ chmod -R a+r *

muhammed
Hors ligne
A rejoint: 04/13/2013

That's probably what happend! I saved my work to a data DVD with Brasero; I guess that the data DVD used a FAT filesystem. I'll use Deja Dup next time!

For the "Change Content" (Write) permissions, what's the difference between "Anyone" and "Owner only"? With "owner only", will I lose my Change Content (Write) permission if I move my file from one computer to another?

If I want to add write permission to all my files in the way that you describe, do I use this command (I'm guessing based on something that I read online):

$ chmod -R a+w *

What does the * in your command mean by the way? Does it represent my choice of top-level directory?

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Every file on GNU/Linux has a owner and a group (users can be belong to many groups). The basic permissions on a regular file allow to specify who has the permissions to read it, write it and execute it depending on who she is and in what groups she is. For instance a file can belong to the user "banana" and to the group "users" and its permissions may state that the owner (here "banana") can read and write, a user in the group (here "users") can only read and other users (not even in the group "users") cannot do anything.

'chmod' is used to change the permissions. In the command I gave you, it does that recursively (option -R), i.e., it will traverses the subdirectories to change the permissions of the files in them. Here "a" means anyone (the user, the group and other users) and "+w" means "add the write permission". To only add that permission to the owner of the files "a" must be changed for "o". By the way, if the command fails, it probably is because you are not even the owner of the files. You can fix that (substitute "banana" with your login):
$ chown -R banana *

As for the "*", it has nothing to do with 'chmod' (or 'chown'). The command interpreter (the Shell) substitutes "*" with all files in the current directory before calling the 'chmod' (or 'chown') on that list of files.

muhammed
Hors ligne
A rejoint: 04/13/2013

Thanks a lot MB!

My computer has only one user at the moment. So for now, I gave "Anyone" write permission. When I add more users, and start grouping the users, then I should think about assigning read/write permission by group/user, right?

I think that "Thanks a lot MB" is my most repeated phrase on this forum. I'll brainstorm synonyms for next time lol.

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Many GNU/Linux systems (Trisquel included) have groups that bear the names of the users. When a user creates a regular file, the default is that the user is its owner (normal), the group is that with the name of the user (and the user normally is its only member); the permissions are rw (i.e., read and write) for the owner and the group, only r (i.e., read) for other users. For directories, the same holds but anyone additionally has the x (i.e., execution) permission... which is not an execution (you cannot "execute" a directory) but a right to traverse the directory.

Notice that you do not want to alter the owner/group or the permissions of system files unless you really know what you are doing!

marioxcc
Hors ligne
A rejoint: 08/13/2014

“*” is substituted with the name of all files (including directories and special files) not beginning with “.” by default. All directories contain “.” and “..” which are pointers to the same, and parent directory, respectively (except for “/”, where both point to the current directory, since “/” has no parent directory). Other files beginning with “.” are by convention, called “hidden files”. At the filesystem level, there is nothing that makes them hidden. Programs usually don't display them. To list all files in a directory, use “ls -la”; to list all except “.” and “..”, use “ls -lA”. “..” is used in relative paths, for example, when changing directory through the command line, a common command is “cd ..”. For recursive use of “chown” using “.” (the current directory). If you want to change permissions of a directory and all of its content, then use “chown -R [...] .” where “[...]” represents other flags. Unlike “chown -R [...] *”, the above command will apply to the current directory and hidden files.

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Obviously, one is not allowed to change the ownership of files she does not own, i.e., I forgot 'sudo' (to get administrative privileges) in the command above:
$ sudo chown -R banana *

And the group probably needs a change too. The command 'chgrp' does just that but 'chown' can do it as well. To set the user and the group to "banana" (the group with one user, "banana", use your login instead):
$ sudo chown -R banana:banana *