Access permission denied linux

Linux Mint Forums

[SOLVED] access permission denied in Linux 17.1

Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

[SOLVED] access permission denied in Linux 17.1

Post by ocaoca » Fri Feb 13, 2015 10:14 am

I have checked everywhere but I can not find an answer to my problem.
I have a PC with Linux 17.1 with an administration user ‘oscar’ and two other users ‘irati’ and ‘casa’. I also have a hard disk ‘old250’ where I want to share some files.

I have created a group called media where I have included casa and oscar users. (By the way I also have plex in this group and it also cannot access the files.)
As you can see below I have given all permissions to media group for /media/oscar and /media/oscar/old250.
However when casa or irati users try to access /media/oscar and /media/oscar/old250, the access is denied

casa@oscar-desktop /media $ groups casa media casa@oscar-desktop /media $ ls -al total 20 drwxr-xr-x 5 oscar media 4096 feb 12 20:25 . drwxr-xr-x 24 root root 4096 feb 1 13:00 .. drwxr-x---+ 2 root root 4096 feb 7 21:09 irati drwxrwxr-x+ 3 root media 4096 feb 13 14:55 oscar drwxr-xr-x 3 oscar media 4096 feb 12 20:38 Shared casa@oscar-desktop /media $ cd oscar -su: cd: oscar: Permission denied casa@oscar-desktop /media $ cd oscar/old250 -su: cd: oscar/old250: Permission denied

So, why user casa can not access the folder it has group permissions to?
Is there alternative way to share files in a hard disk?
Does somebody know what ‘+’ means in the permission string drwxrwxr-x+?

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

Re: access permission denied in Linux 17.1

Post by Habitual » Fri Feb 13, 2015 11:29 am

is that the same ‘oscar’ as in oscar-desktop?

How did you add these users to media? Did they log out and back in for new group perms to ‘take’?
Did you umount and remount the resource after they did?

What’s the output of terminal >

Re: access permission denied in Linux 17.1

Post by altair4 » Fri Feb 13, 2015 12:48 pm

In this case it indicates extended directory attributes are being applied. Run this instead to find the «true» permissions:

You really shouldn’t mess with the permissions of /media/oscar since it was created by the system. If you do change them it will work until is doesn’t. There may be a future update of something that returns it to the default.

Читайте также:  Linux delete directory with file

Anywho, the way this was designed only oscar has permissions to get to whatever is mounted under it. It would be better to mount the partition under /media ( as in /media/old250 ) instead.

There is something else I should point out and it has to do with what you mean by «share».

If you wan’t a folder that all the other users can add to and remove files that will work in Mint.
If you want a folder where all the other users can add to, remove, but also edit each other’s files that will not work in Mint. ( edit ) unless the folder is in an ntfs partition.

If you want the latter I would suggest either using something like bindfs or switching to Ubuntu or something in the Ubuntu family instead.

Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

karlchen Level 22
Posts: 17364 Joined: Sat Dec 31, 2011 7:21 am Location: Germany

Re: access permission denied in Linux 17.1

Post by karlchen » Fri Feb 13, 2015 1:17 pm

If you wan’t a folder that all the other users can add to and remove files that will work in Mint.
If you want a folder where all the other users can add to, remove, but also edit each other’s files that will not work in Mint.
If you want the latter I would suggest either using something like bindfs or switching to Ubuntu or something in the Ubuntu family instead.

I do not quite understand what you have in mind with the last 2 sentences.
Ubuntu and Linux Mint share everything except the graphical desktop. So why should something be possible on Ubuntu that cannot be done on Mint?

By now the second sentence which I quoted (see above) has been «amended» to read

If you want a folder where all the other users can add to, remove, but also edit each other’s files that will not work in Mint. ( edit ) unless the folder is in an ntfs partition.

Actually, this «amendment» makes the statement completely wrong. It was wrong before. With the «amendment» it is totally wrong.

Below you will be given an example on how to create a folder «where all the other users can add to, remove, but also edit each other’s files.»
Actually whether everybody may modify a file inside a folder depends on the access permissions which have been assigned to owner, group, other on the file!
Therefore you will be given an example on how to create a file which everybody can read and modify, too.
All this will be done on Linux Mint 13, based on Ubuntu 12.04, and it will be done on the ext4 filesystem where Linux Mint 13 lives, not fat32 or ntfs filesystem involved or needed.

The example below makes use of the commands umask and chmod to make sure that the access permissions on the folder and on the files are set in such a way that full read and write permissions are granted to the owner, the owner’s group and others.
You need to understand that access permissions on folder and file objects depend on the object owner, his group and on others and on the permissions which have been assigned to the object owner, his group and others.
They do not depend on the starting value which a given Linux distribution for umask.
While I would not know of a way to change the umask inside a graphical file-manager, the command functionality of the comand chmod can be found inside the graphical file-manager as well.
Two more commands which help maintain access permissions are chown and chgrp. Their functionality can be found inside a graphical file-manager as well. (These 2 commands, however will not be used in the example below.)
Note:
Only the owner of an object will be permitted to use chmod, chown, chgrp on an object. Exception: root can do so on everybody’s objects.

Читайте также:  Red hat enterprise linux сертификат

2. How to create a folder with full access permissions for everyone:

If you want to make sure that everybody can create objects, modify objects and delete objects in a folder, create the folder like this

mkdir yesyoucan; chmod a+rwx yesyoucan
$ ls -ald yesyoucan/ drwxrwxrwx 2 karl karl 4096 Feb 13 18:04 yesyoucan/

Obviously everybody has got full access to this folder.

Note:
What has been explained here using the commandline can be done using your graphical file-manager as well.

3. How to create a file with full access permissions for everyone:

3.1 How to use umask for this purpose:

This is the normal umask. Result: If you create a textfile e.g. you will have rw-, your group and everybody else (others) will have r— access only.
So what we do now is to change this:

umask 000; gedit everybodyeditme.txt

We set the umask to 000. As a result gedit will create the file everybodyeditme.txt with the permissions rw-rw-rw- (me, group, others). So everybody can do what they like with this file. (Beware the umask will remain on 000 till you change it again or till you close the terminal window.)
Verfication:

$ ls -Al -rw-rw-rw- 1 karl karl 37 Feb 13 18:06 everybodyeditme.txt

Note:
I admit I do not know how to change the umask in a graphical tool. So the explained approach will have to be used inside a terminal window.

3.2 How to use chmod for this purpose:

Of course we can achieve the same result in a different way, too.

umask 0022; gedit normalaccess.txt
$ ls -Al -rw-rw-rw- 1 karl karl 37 Feb 13 18:06 everybodyeditme.txt -rw-r--r-- 1 karl karl 20 Feb 13 18:12 normalaccess.txt
chmod go+w normalaccess.txt
$ ls -Al -rw-rw-rw- 1 karl karl 37 Feb 13 18:06 everybodyeditme.txt -rw-rw-rw- 1 karl karl 20 Feb 13 18:12 normalaccess.txt

rw-rw-rw- for both files now.

Читайте также:  Linux red hat создать файл

Note:
What has been explained here using the commandline can be done using your graphical file-manager as well.

  • The Linux access permission concept which is based on owner, group and others and on the permissions which can be granted to owner, group and others. Find a brief explanation e.g. here: Permissions
  • How to change access permissions using chmod. Find the instruction here:

It would be possible to achieve the goal even if the users oscar, irati and casa were not members in a common user group. But in fact, they are.
This would allow for another little chgrp/chmod «trick», which makes use of the «S» bit for the group of the objects «media».
But explaining this is outside the scope of this post.

Last edited by karlchen on Sat Feb 14, 2015 6:35 am, edited 3 times in total.
Reason: Extended and restructured my post. Hopefully it will be perceived as an amendment and help understand what I wanted to explain.

Image

The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 500 days now.
The Prophet’s Song

Источник

Ошибка «Permission denied» в Linux

Все операционные системы семейства Linux имеют четко разграниченные права доступа. В своей домашней директории пользователь может делать все, что ему угодно, до тех пор, пока укладывается в отведенные рамки. Попытка выйти за них приводит к появлению ошибки «Permission Denied».

Изменение прав в терминале

Рассмотрим вариант, в котором необходимо прочесть текстовый документ, созданный другим пользователем. Файлы TXT в Linux можно просматривать непосредственно в терминале с помощью команды «cat».

    Заходим в каталог с интересующим нас документом. Набираем команду «cat filename», подставляя вместо «filename» имя нужного файла. На скриншоте показана ошибка «Permission Denied», выглядящая в русской локализации как «Отказано в доступе».

Ошибка «Permission Denied»

Получаем ошибку «Permission Denied» при попытке просмотреть содержимое файла

Просмотр прав доступа командой «ls»

Проверяем права доступа к документу используя команду «ls -l»

Изменение прав доступа командой «chmod»

Используем команду «chmod» и административные права для получения доступа

Просмотр текстового файла командой «cat»

Просматриваем содержимое текстового документа командой «cat»

Изменение прав в файловом менеджере

Разберемся, как выполнить рассмотренную выше операцию в графическом интерфейсе, используя файловый менеджер из дистрибутива.

    Как видно на скриншоте, значок файла изначально имеет дополнительные символы, указывающие на то, что доступ у нему ограничен. При попытке посмотреть содержимое получаем графический вариант ошибки «Permission Denied».

Графический вариант ошибки «Permission Denied»

При попытке открыть текстовый документ получаем ошибку «Permission Denied»

Переключение файлового менеджера в режим root

Открываем меню «Файл» и перезапускаем файловый менеджер от имени root

Окно аутентификации root

Набираем пароль root в окне аутентификации

Контекстное меню файлового менеджера

Открываем параметры файла с помощью контекстного меню

Вкладка «Права» в свойствах файла

На вкладке «Права» разрешаем доступ для группы root и остальных пользователей

Файл, открытый в режиме чтения

Открываем ранее недоступный файл в режиме чтения и изучаем содержимое

В заключение

Как видим, избавиться от ошибки Permission Denied достаточно просто. Решив изменить правда доступа к системным файлам, лишний раз убедитесь, что полностью уверены в своих действиях и понимаете последствия вносимых изменений.

Источник

Оцените статью
Adblock
detector