LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   File permissions can't be changed with chmod (https://www.linuxquestions.org/questions/linux-general-1/file-permissions-cant-be-changed-with-chmod-4175676979/)

cad-guy 06-12-2020 01:36 PM

File permissions can't be changed with chmod
 
Hello;
I would like to ask for advice on a file permissions problem using Parrot-Linux. I've had various issues with access because the OS runs on an SSD and my data is on a separate spinning disk drive. Because of the situation, I've learned more about chown/chmod. When that didn't solve the problem, a very skilled friend suggested the following:

sudo mount -o remount,rw '/media/username/882D-54D6'
Go to Disk Utility and unmount the disk. Then click on Check Filesystem if there are no problems remount the disk. After mounting the disk it should work correctly.

Recently I've found that a documents folder cannot be edited. I tried all of the above options and still cannot get access. Here is a segment of current permissions with ls -l
-rw-r--r-- 1 bikejunkie bikejunkie 98 Jun 3 2012 chinese.txt
drwxr-xr-x 3 bikejunkie bikejunkie 32768 May 27 13:30 Computer-linux
-rw-r--r-- 1 bikejunkie bikejunkie 720 May 15 2019 computer.txt
-rw-r--r-- 1 bikejunkie bikejunkie 1649664 Jan 4 2005 Consciousness-lecture.doc
-rw-r--r-- 1 bikejunkie bikejunkie 1378 Jun 21 2015 conversions.txt
-rw-r--r-- 1 bikejunkie bikejunkie 28960 Apr 6 2013 couv2couv-journal.odt
drwxr-xr-x 2 bikejunkie bikejunkie 32768 Jun 5 23:30 current-events

If you have ideas I would appreciate, if there is a particular term or method that I can research to learn more, that would also be great.

berndbausch 06-12-2020 06:50 PM

Since directories can't be edited in principle, "a documents folder cannot be edited" is expected behaviour.
Can you share what exactly you are trying to do? Which command(s) are you running, how do they fail?
Are you running the command(s) under the bikejunkie identity?
What filesystem type is /media/username/882D-54D6?

agillator 06-12-2020 08:22 PM

If you are working as root (su or sudo) then directory permissions and ownership are definitely editable. So, as asked, are you using the commands as root? And I assume that the removable drive is one of the Linux file systems, not a Windows file system.

berndbausch 06-12-2020 08:32 PM

Quote:

Originally Posted by agillator (Post 6133692)
And I assume that the removable drive is one of the Linux file systems, not a Windows file system.

The name indicates Windows.

agillator 06-12-2020 09:44 PM

berndbausch, you are correct. The first thing I do when I buy a new removable drive is wipe it and put a new file system on it. I also label my file systems for ease of referring to them and identifying them. I thought that if I did not provide a label the label would remain the same, but you know what Thought did (he just thought he did). I was thinking I had actually done that but obviously I was wrong . . . again. I just tested one and . . . you are correct.

cad-guy 06-14-2020 09:34 PM

1 Attachment(s)
Hello and thank you so far for the replies

"Since directories can't be edited in principle, "a documents folder cannot be edited" is expected behaviour.
Can you share what exactly you are trying to do? Which command(s) are you running, how do they fail?
Are you running the command(s) under the bikejunkie identity?
What filesystem type is /media/username/882D-54D6?"

I only showed the directory tree from higher up so the files and folders could both be viewed. But the error that I had was from within the lowest folder (only the files w/ no directories). What I have been trying to do is open a .odt file with LibreOffice. I'm enclosing a screenshot of that as well if it makes things more clear.
The filesystem for 882D-54D6 is FAT32 (I use this drive with both linux and with certain windows programs.

"Can you share what exactly you are trying to do? Which command(s) are you running, how do they fail?
Are you running the command(s) under the bikejunkie identity?
What filesystem type is /media/username/882D-54D6?"

At first I was simply trying to open the file in LibreOffice which worked fine dozens of times before. But periodically this drive has had file permission issues which is why I learned chmod/chown. When the failure happened, I went into terminal and used 'sudo chmod 777 filename' there was no error in the terminal, but LibreOffice wouldn't open.

I just performed the command again and LibreOffice finally did open it.
Thank you
I would call this issue resolved, except that the file still reads '-rw-r--r--' as do all of the other files. I did 'sudo chmod -R 777 foldername' and this did not change the permissions state of the files within the folder.
Is it possible that these permission errors are due to the FAT32 system?

berndbausch 06-14-2020 10:07 PM

FAT32 (and the other types of FAT, including exFAT) doesn't have the notion of owner or file permissions. For this reason, chmod has no effect.

Your computer probably uses the vfat filesystem module (I am 99% certain). In this case, you can change both ownership and permissions at mount time. See the Linuxquestions wiki page on vfat, or search the internet for details. If you mounted that drive via the GUI, or it was mounted automatically, I can't advise you, but I am sure there are solutions.

ehartman 06-14-2020 11:33 PM

Quote:

Originally Posted by berndbausch (Post 6134422)
If you mounted that drive via the GUI, or it was mounted automatically, I can't advise you, but I am sure there are solutions.

Use, from the commandline. as root, the "remount" option with the right permissions.
Quote:

remount
Attempt to remount an already-mounted filesystem. This is commonly used to change the mount flags for a filesystem, especially to make a readonly filesystem writable. It does not change device or mount point.

The remount functionality follows the standard way how the mount command works with options from fstab. It means the mount command doesn't read fstab (or mtab) only when a device and dir are fully specified.

Roken 06-15-2020 12:47 AM

Have you also played with chattr and possibly set the immutable bit on any of those files?

To test, on any one of them, try:

Code:

sudo chattr -i filename


All times are GMT -5. The time now is 05:15 PM.