Root~у не хватает прав-/ (15)

>этим собственно все скказано:
>
>[root@samba /]# chmod 777 /sbin
>chmod: changing permissions of `/sbin’: Operation not permitted
>
>такое возможно разве?
>как лечить?
>
>диск проверял — ошибок нет.

ls -ldo /sbin ? флагов никаких не стоит ли?

Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>этим собственно все скказано:
>>
>>[root@samba /]# chmod 777 /sbin
>>chmod: changing permissions of `/sbin’: Operation not permitted
>>
>>такое возможно разве?
>>как лечить?
>>
>>диск проверял — ошибок нет.
>
>ls -ldo /sbin ? флагов никаких не стоит ли?

[root@samba /]# ls -ldo /sbin
drwxr-xr-x 2 root 8192 Oct 25 07:57 /sbin

«/sbin» синего цвета выдало

2 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 11:28
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>[root@samba /]# ls -ldo /sbin
>drwxr-xr-x 2 root
> 8192 Oct 25 07:57 /sbin
>
>»/sbin» синего цвета выдало
;)))
система какая? man на ls чтобы посмотреть установленные флаги

3 . «root

у не хватает прав :-/»

Сообщение от Дениска (ok) on 01-Мрт-06, 11:34
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>[root@samba /]# ls -ldo /sbin
>>drwxr-xr-x 2 root
>> 8192 Oct 25 07:57 /sbin
>>
>>»/sbin» синего цвета выдало
>;)))
>система какая? man на ls чтобы посмотреть установленные флаги
Тогда уж
lsattr -d /sbin
и смотреть, чтоб не было буковки i

4 . «root

у не хватает прав :-/»

Сообщение от madskull (ok) on 01-Мрт-06, 11:39
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>>[root@samba /]# ls -ldo /sbin
>>>drwxr-xr-x 2 root
>>> 8192 Oct 25 07:57 /sbin
>>>
>>>»/sbin» синего цвета выдало
>>;)))
>>система какая? man на ls чтобы посмотреть установленные флаги
>Тогда уж
>lsattr -d /sbin
>и смотреть, чтоб не было буковки i

есть 🙁
[root@samba /]# lsattr -d /sbin
suSiadAc—— /sbin

6 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 11:46
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>>>[root@samba /]# ls -ldo /sbin
>>>>drwxr-xr-x 2 root
>>>> 8192 Oct 25 07:57 /sbin
>>>>
>>>>»/sbin» синего цвета выдало
>>>;)))
>>>система какая? man на ls чтобы посмотреть установленные флаги
>>Тогда уж
>>lsattr -d /sbin
>>и смотреть, чтоб не было буковки i
>
>есть 🙁
>[root@samba /]# lsattr -d /sbin
>suSiadAc—— /sbin
ну так man chattr и убирай ее

7 . «root

у не хватает прав :-/»

Сообщение от madskull (ok) on 01-Мрт-06, 11:57
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>>>>[root@samba /]# ls -ldo /sbin
>>>>>drwxr-xr-x 2 root
>>>>> 8192 Oct 25 07:57 /sbin
>>>>>
>>>>>»/sbin» синего цвета выдало
>>>>;)))
>>>>система какая? man на ls чтобы посмотреть установленные флаги
>>>Тогда уж
>>>lsattr -d /sbin
>>>и смотреть, чтоб не было буковки i
>>
>>есть 🙁
>>[root@samba /]# lsattr -d /sbin
>>suSiadAc—— /sbin
>ну так man chattr и убирай ее

все заработало
пасиба ОГРОМНОЕ.
еще убрал опцию «a» для возможности удаления файлов

9 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 12:45
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

Я вот все думаю, спросить или нет: а зачем ставить на /sbin права 777.
Не, не буду спрашивать.

10 . «root

у не хватает прав :-/»

Сообщение от madskull (ok) on 01-Мрт-06, 12:50
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>Я вот все думаю, спросить или нет: а зачем ставить на /sbin
>права 777.
>Не, не буду спрашивать.

да мне не трудно.
777 только для примера.
в общем история со слезами на глазах:
решил самбу обновить. поставилась в общем написала все ок.
для проверки ребутнул. все загрузилось написало, что круто.
посмотрел версию — старая. пароли проверяться перестали, дисков нет.
nmb работает, smb нет.
21:30 притаскиваю парнишку который лучше меня разбирается. 2 часа жесткого порно позволили понять, что поменялись часть файлов.
22:30 начинаем поднимать бакап. домой приехал только сегодня около двух.

11 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 13:25
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

8 . «root

у не хватает прав :-/»

Сообщение от mcduck on 01-Мрт-06, 12:15
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

а с этого моста можно по подробнее. плиииз 0:-)

сам не люблю чайникам отвечать, но мне больше спросить негде.

12 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 13:27
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

Как-то (довольно давно) пришлось разбираться с rootkit-ом на RH9.
Так вот эта «сигнатура» — suSiadAc — сильно мне запомнилась, т.к. по «молодости» никак не мог понять, как и вы, почему я не могу восстановить системные утилиты в каталогах /bin, /sbin и т.п. Chkrootkit помог найти начало ниточки, потом восстановил netstat, top, ps и т.п., ну и дальше почистил. Уверенности (в системе), правда, это не добавило. А поскольку бокс был «полутестовым», то просто переустановил ОС.

13 . «root

у не хватает прав :-/»

Сообщение от mcduck on 02-Мрт-06, 11:23
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>Как-то (довольно давно) пришлось разбираться с rootkit-ом на RH9.
>Так вот эта «сигнатура» — suSiadAc — сильно мне запомнилась, т.к. по
>»молодости» никак не мог понять, как и вы, почему я не
>могу восстановить системные утилиты в каталогах /bin, /sbin и т.п. Chkrootkit
>помог найти начало ниточки, потом восстановил netstat, top, ps и т.п.,
>ну и дальше почистил. Уверенности (в системе), правда, это не добавило.
>А поскольку бокс был «полутестовым», то просто переустановил ОС.

спасибо за ответ. то что у меня машина в усмерть заражена я уже понял. наполовину вылечил — пока работает. в выходные попробую поставить RHEL.
пожелайте мне удачи. 😀

14 . «root

у не хватает прав :-/»

Сообщение от Mosson on 02-Мрт-06, 15:28
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

Ну, если поможет, то — удачи !
Кстати, я ставил Scientific Linux 4.2 — некий компромисс между RHEL и новизной пакетов Fedora Core. И средства защиты/безопасности там есть.

15 . «root

у не хватает прав :-/»

Сообщение от mcduck on 02-Мрт-06, 16:37
Правка | Высказать мнение | Ответить | Cообщить модератору | Наверх

>>этим собственно все скказано:
>>
>>[root@samba /]# chmod 777 /sbin
>>chmod: changing permissions of `/sbin’: Operation not permitted
>>
>>такое возможно разве?
>>как лечить?
>>
>>диск проверял — ошибок нет.
>
>ls -ldo /sbin ? флагов никаких не стоит ли?

[root@samba /]# ls -ldo /sbin
drwxr-xr-x 2 root 8192 Oct 25 07:57 /sbin

Chmod operation not permitted

Hi all, I’ve been seeing these messages popping up for me occasionally and I think I’ve tracked down the cause. The full error is:

PHP Warning: chmod(): Operation not permitted in /var/. /lib/filestorage/file_storage.php on line 2194, referer: http://. /course/delete.php?id=103

Our Moodledata directory is set to root:apache permissions with 0660 on the files. But even though the apache user is allowed to write the files, because it is not the owner, it’s not allowed to chmod the files.

I’m thinking now the proper ownership on the moodledata directory be apache:apache, What are people’s thoughts?

Re: chmod(): Operation not permitted — which user should be moodledata owner?

If that’s the apache owner on your server then, yes, it’s apache:apache. If the machine isn’t shared you could just chmod -R 0777 your moodledata.

Re: chmod(): Operation not permitted — which user should be moodledata owner?

You wrote:
> Our Moodledata directory is set to root:apache permissions with 0660 on the files.

It should be possible to have root as the owner of the moodledata directory, provided that you give the apache-user full write permissions in moodledata. What does ls -ld /path/to/moodledata show? In your case it should print something like drwxrwxXXX root apache-group (X means don’t care).

> But even though the apache user is allowed to write the files, because it is not the owner, it’s not allowed to chmod the files.

A bit of a confusion there — your apache-user and apache-group both are called apache!

Anyway, could the problem a) missing x in moodledata, I mean drwxrw-XXX instead of drwxrwxXXX? Or, $CFG->directorypermissions not right?

Re: chmod(): Operation not permitted — which user should be moodledata owner?

Good note about differentianting between apache-user and apache-group.

We’ve been running with it set to root:apache-group for a number of years, the moodledata folder itself has permissions drwxrws—

Config.php has $CFG->directorypermissions = 02770;

I just did test though, and on my system, CentOS 7, group write permissions on a file do not let you chmod it. An account can only chmod a file/folder that it is the owner of.

This would explain all the historical reports of chmod() operation not permitted, because unless the actual apache/web server user is the owner of the files in the moodledata folder, it will not be allowed to run chmod on the files and the errors will be generated.

Re: chmod(): Operation not permitted — which user should be moodledata owner?

It does state it should be owned by apache-user and group set to apache-group. Looks like I’ve been running it incorrectly for a while. Atleast now I know!

1. moodledata directory and all of its contents (and subdirectories, includes sessions):

2. moodle directory and all of its contents and subdirectories (including config.php):

If you allow local logins for regular users, then 2. should be:

Re: chmod(): Operation not permitted — which user should be moodledata owner?

You wrote:
> It does state it should be owned by apache-user and group set to apache-group. Looks like I’ve been running it incorrectly for a while.

In my opinion Moodle does allow a number of combinations for the owner, group and permissions of the moodledata directory and its contents. (Let us limit the discussion to moodledata/, leave moodle/ out.) In fact I have Moodle instances running where the owner of moodledata/ is not the apache-user.

> group write permissions on a file do not let you chmod it. An account can only chmod a file/folder that it is the owner of.

You are right. But I have never encountered this as a problem. Is it an error or just a warning? Do you have any idea why Moodle needs to change the permissions of files/directories within moodledata/ _after_ they have been created?

Re: chmod(): Operation not permitted — which user should be moodledata owner?

> Is it an error or just a warning? Do you have any idea why Moodle needs to change the permissions of files/directories within moodledata/ _after_ they have been created?

It states PHP Warning, and it looks to be in the «deleted_file_cleanup» function. You can see the code here: https://github.com/moodle/moodle/blob/master/lib/filestorage/file_storage.php#L2194

I’m not quite sure why that piece of code changes permissions on file it’s deleting, but it’s been there since before 2010 and that’s as far back as I can go in the Github history. Seems to have been in place for Moodle 2.0, not sure if earlier.

chmod: changing permissions of ‘drop_caches’: Operation not permitted

[email protected]:/proc/sys/vm# chmod 666 drop_caches
chmod: changing permissions of ‘drop_caches’: Operation not permitted

[email protected]:/proc/sys/vm# id
uid=0(root) gid=0(root) groups=0(root)

Any other ways to perform this as non root: echo 3 > /proc/sys/vm/drop_caches

Comments

Not that I know of.

echo 3 | sudo tee /proc/sys/vm/drop_caches

Indeed, the point was to chmod the «file» rights to not have to sudo though.

There’s no permissions on /proc as it’s a virtual file system. They aren’t actually real files.

@Daniel15 said:
They aren’t actually real files.

That I was aware of, I’m sure though someone could write a kernel patch for it but meh, sudo will have to do for now.

You could write a basic app (eg. in C or Go or some other compiled language) that updates the file, and then setuid the executable so it runs as root even for non-root users.

@Daniel15 said:
They aren’t actually real files.

That I was aware of, I’m sure though someone could write a kernel patch for it but meh, sudo will have to do for now.

A better question might be why you’re wanting a non root user to drop all your filesystem caches anyway. What’s the point?

Afterburst — Awesome OpenVZ&KVM VPS in US+EU

@jackb said:
A better question might be why you’re wanting a non root user to drop all your filesystem caches anyway.

@jackb said:
A better question might be why you’re wanting a non root user to drop all your filesystem caches anyway.

My point was there probably isn’t a valid reason that doesn’t have a better solution.

Afterburst — Awesome OpenVZ&KVM VPS in US+EU

Like already mentioned it is just a virtual filesystem.
To change ownership of those «files» you would want to patch the kernel/modify the source.

EDIT:
Let me take the opportunity to mention Hetzner.

@eol said:
EDIT:
Let me take the opportunity to mention Hetzner.

Good luck with your Hetzner.

I wish I could help mate

Purveyor of high quality potassium

EDIT:
Maybe «uid=» and/or «gid=» will help.
But it has security implications.

This is the only thread where eol is actually answering the question, I am so touched to see this.

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@FAT32 said:
This is the only thread where eol is actually answering the question, I am so touched to see this.

LOL.
Not true.
I actually answered quite a lot.

@eol said:
LOL.
Not true.
I actually answered quite a lot.

My apology, I am being distracted by some of your posts with nearly 0 contents.

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@FAT32 said:
My apology, I am being distracted by some of your posts with nearly 0 contents.

@Daniel15 said:
You could write a basic app (eg. in C or Go or some other compiled language) that updates the file, and then setuid the executable so it runs as root even for non-root users.

Anyway, why isn’t this an option? I believe this should work for your case, you can even restrict the drop_caches modes using this additional executable file.

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

Is this OpenVZ? Because if it is. It’s containerization, not virtualization. You might find weird seemingly crippling stuff living outside user space.

You are dreaming. | And it’s a nightmare. | THE SECRET THREAD | THE TRUTH | HA VE S YOU SEEN THIS YURA?
„Homo homini rattus.“ | It’s not nightmare, it’s reality, but it’s still nightmare.

If it’s OVZ drop it for KVM.

EDIT:
Did you try set uid and gid for the /proc filesystem in /etc/fstab and reboot?

@eol said:
Did you try set uid and gid for the /proc filesystem in /etc/fstab and reboot?

Production server, not “toying around” with the fstab.

Ok.
On a production server I wouldn’t do it either because it has security implications.

@tcp6 said:
Production server, not “toying around” with the fstab.

So what’s wrong with making another executable that does the job?

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@tcp6 said:
Production server, not “toying around” with the fstab.

So what’s wrong with making another executable that does the job?

Nothing is wrong. I went the +S route on a .sh script. Simple as that.

@tcp6 said:
Nothing is wrong. I went the +S route on a .sh script. Simple as that.

Great, I am just feeling uncomfortable that you ignored both mine and Daniel’s comment.

Just make sure the correct permissions are set and sanitise the inputs to the script.

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

Ummm couldn’t get it to work either.

-rwsr-sr-x 1 root root 44 Dec 30 09:46 /bin/ram.sh

stat /bin/ram.sh
File: /bin/ram.sh
Size: 44 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 261194 Links: 1
Access: (6755/-rwsr-sr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-12-30 09:50:55.848827387 +0800
Modify: 2018-12-30 09:46:46.799199077 +0800
Change: 2018-12-30 09:50:52.676755709 +0800

!/bin/sh

echo 3 > /proc/sys/vm/drop_caches

ram.sh
/bin/ram.sh: 2: /bin/ram.sh: cannot create /proc/sys/vm/drop_caches: Permission denied

!/bin/sh

echo 3 > /proc/sys/vm/drop_caches

ram.sh
/bin/ram.sh: 2: /bin/ram.sh: cannot create /proc/sys/vm/drop_caches: Permission denied

Of course it fails.
It executes with your current user permissions.

You can either write to /proc as root/superuser or try to change the /proc filesystem permissions in /etc/fstab, modify the kernel source or code a snippet of C.

So apparently there is a way of doing this, but it is a bad idea from security standpoint:

I’ve tested it on ubuntu, it seems to work. Sorry i cannot paste the text, CloudFlare thinks i am hacking LET, so i’ll post a screen shot.

You are dreaming. | And it’s a nightmare. | THE SECRET THREAD | THE TRUTH | HA VE S YOU SEEN THIS YURA?
„Homo homini rattus.“ | It’s not nightmare, it’s reality, but it’s still nightmare.

@eol said:
Of course it fails.
It executes with your current user permissions.

I’ve tried -rwsr-xr-x and -rwsr-sr-x.
Sorry but I really don’t want to fiddle around with the /etc/fstab unless it’s a last resort.

Create the C code and compile it

dropcaches.c

EDIT: Modified the system call to use full path

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@eol said:
Of course it fails.
It executes with your current user permissions.

I’ve tried -rwsr-xr-x and -rwsr-sr-x.
Sorry but I really don’t want to fiddle around with the /etc/fstab unless it’s a last resort.

Sure.
While it might work it has severe security implications.

@Janevski said:
So apparently there is a way of doing this, but it is a bad idea from security standpoint:

I’ve tested it on ubuntu, it seems to work. Sorry i cannot paste the text, CloudFlare thinks i am hacking LET, so i’ll post a screen shot.

Exactly what I needed. Kudos for that.

@FAT32 said:
Create the C code and compile it

dropcaches.c

@FAT32 said:
Create the C code and compile it

dropcaches.c

EDIT:
Code update.

@FAT32 said:
Create the C code and compile it

dropcaches.c

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

Sure works on a KVM VPS, however on an OpenVZ VPS, that’s a no-go.

After reading the comment and the StackOverflow post by @Janevski, I forgot that the «PATH» environment variable can be changed to a malicious one.

Please change the system call to the following to secure the system:
system(«/bin/echo 3 > /proc/sys/vm/drop_caches»);

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@FAT32 said:
After reading the comment and the StackOverflow post by @Janevski, I forgot that the «PATH» environment variable can be changed to a malicious one.

Please change the system call to the following to secure the system:
system(«/bin/echo 3 > /proc/sys/vm/drop_caches»);

Makes sense, would you mind editing your initial code snippet as well? In case someone else stumbles on it someday and doesn’t bother reading further.

@tcp6 said:
Makes sense, would you mind editing your initial code snippet as well? In case someone else stumbles on it someday and doesn’t bother reading further.

I did, perhaps you and @eol can update the quote as well

«Everyone you meet is fighting a battle you know nothing about. Be kind. Always.»

@tcp6 said:
Makes sense, would you mind editing your initial code snippet as well? In case someone else stumbles on it someday and doesn’t bother reading further.

I did, perhaps you and @eol can update the quote as well

Done on my end.

@tcp6 said:
Makes sense, would you mind editing your initial code snippet as well? In case someone else stumbles on it someday and doesn’t bother reading further.

I did, perhaps you and @eol can update the quote as well

Will all that being said, OpenVZ really needs to die.

  • Can’t swapon -a.
  • Can’t flush memory buffers.
  • Can’t use FUSE properly if it hasn’t been compiled as a module on the host node.

I can’t believe people in the hosting industry are still using OVZ.

@tcp6 said:
Will all that being said, OpenVZ really needs to die.

Now there is still a security problem.
One could replace the echo binary with something slightly more malicious.
But anyway problem solved.

@tcp6 said:
Will all that being said, OpenVZ really needs to die.

  • Can’t swapon -a.
  • Can’t flush memory buffers.
  • Can’t use FUSE properly if it hasn’t been compiled as a module on the host node.

I can’t believe people in the hosting industry are still using OVZ.

We love OVZ if we don’t need to do the above mentioned things. For everything else there is KVM or bare back metal.

Команда chmod Linux

Система полномочий в Linux имеет очень важное значение, поскольку благодаря ей можно разделять привилегии между пользователями, ограничить доступ к нежелательным файлам или возможностям, контролировать доступные действия для сервисов и многое другое. В Linux существует всего три вида прав — право на чтение, запись и выполнение, а также три категории пользователей, к которым они могут применяться — владелец файла, группа файла и все остальные.

Эти права применяются для каждого файла, а поскольку все в системе Linux, даже устройства, считаются файлами, то, получается что эти права применимы ко всему. Мы более подробно рассматривали как работают права доступа к файлам Linux в отдельной статье, а этой, я хочу остановиться на команде chmod, которая используется для установки прав.

Команда chmod Linux

Эта команда имеет типичный для команд linux синтаксис, сначала команда, затем опции, а в конце файл или папка, к которой ее нужно применить:

$ chmod опции права /путь/к/файлу

Сначала рассмотрим какими бывают права доступа linux и как они устанавливаются. Пред этим рекомендую прочитать статью про права, ссылка на которую есть выше. Есть три основных вида прав:

  • r — чтение;
  • w — запись;
  • x — выполнение;
  • s — выполнение от имени суперпользователя (дополнительный);

Также есть три категории пользователей, для которых вы можете установить эти права на файл linux:

  • u — владелец файла;
  • g — группа файла;
  • o — все остальные пользователи;

Синтаксис настройки прав такой:

группа_пользователей действие в ид_прав

В качестве действий могут использоваться знаки «+» — включить или «-« — отключить. Рассмотрим несколько примеров:

  • u+x — разрешить выполнение для владельца;
  • ugo+x — разрешить выполнение для всех;
  • ug+w — разрешить запись для владельца и группы;
  • o-x — запретить выполнение для остальных пользователей;
  • ugo+rwx — разрешить все для всех;

Но права можно записывать не только таким способом. Есть еще восьмеричный формат записи, он более сложен для понимания, но пишется короче и проще. Я не буду рассказывать как считать эти цифры, просто запомните какая цифра за что отвечает, так проще:

  • 0 — никаких прав;
  • 1 — только выполнение;
  • 2 — только запись;
  • 3 — выполнение и запись;
  • 4 — только чтение;
  • 5 — чтение и выполнение;
  • 6 — чтение и запись;
  • 7 — чтение запись и выполнение.

Права на папку linux такие же, как и для файла. Во время установки прав сначала укажите цифру прав для владельца, затем для группы, а потом для остальных. Например, :

  • 744 — разрешить все для владельца, а остальным только чтение;
  • 755 — все для владельца, остальным только чтение и выполнение;
  • 764 — все для владельца, чтение и запись для группы, и только чтение для остальных;
  • 777 — всем разрешено все.

Каждая из цифр не зависит от предыдущих, вы вбираете именно то, что вам нужно. Теперь давайте рассмотрим несколько опций команды, которые нам понадобятся во время работы:

  • -c — выводить информацию обо всех изменениях;
  • -f — не выводить сообщения об ошибках;
  • -v — выводить максимум информации;
  • —preserve-root — не выполнять рекурсивные операции для корня «/»;
  • —reference — взять маску прав из указанного файла;
  • -R — включить поддержку рекурсии;
  • —version — вывести версию утилиты;

Теперь, когда вы знаете опции и как настраиваются права доступа chmod, давайте рассмотрим несколько примеров как работает команда chmod linux.

Примеры использования chmod

Я не буду приводить много примеров, так как там и так все более-менее понятно после пояснения правил создания выражений установки прав. Сначала самый частый случай — разрешить выполнения скрипта владельцу:

Или можно воспользоваться цифровой записью:

chmod 766 file
ls — l file

Недостаток цифровой записи в том, что вы не можете модифицировать уже существующие права доступа linux. Например, в первом варианте вы просто добавили флаг выполнения для владельца файла, а все остальные права оставили неизменными. В восьмеричном варианте мы полностью заменили текущие права новыми — все для владельца и чтение/запись для группы и остальных. Как видите, права установлены как и ожидалось. Теперь отключим выполнение владельцем:

И снова проверяем:

Дальше разрешим только чтение всем, кроме владельца:

chmod 744 file
ls -l file

Или отберем все права:

chmod ugo-rwx file

Файлы с правами 000 недоступны никаким пользователям, кроме суперпользователя и владельца. Вернем права обратно:

chmod 755 file
ls -l file

Такая же ситуация с файлами, владельцем которых вы не являетесь, если вы хотите изменить их права — используйте sudo. Из модификаторов прав вы можете конструировать любые последовательности, я думаю тут нет смысла разбирать их все. Для того чтобы поменять права на все файлы в папке используйте опцию -R:

chmod -R ug+rw dir
ls -l dir/

Также вы можете смотреть подробную информацию про вносимые изменения, например:

chmod -Rv ug+rw dir

Выводы

В этой небольшой статье была рассмотрена команда chmod linux. Она очень часто используется наряду с такими командами, как chown и umask для управления правами. Надеюсь, эта информация была полезной для вас. Если у вас остались вопросы, спрашивайте в комментариях!

Chmod operation not permitted

Краткое описание:
Termux сочетает в себе мощные эмуляцию терминала с обширной коллекцией пакетов Linux.

Termux combines powerful terminal emulation with an extensive Linux package collection.

• Enjoy the bash and zsh shells.
• Edit files with nano and vim.
• Access servers over ssh.
• Compile code with gcc and clang.
• Use the python console as a pocket calculator.
• Check out projects with git and subversion.
• Run text-based games with frotz.

At first start a small base system is downloaded — desired packages can then be installed using the apt package manager known from the Debian and Ubuntu Linux distributions. Access the built-in help by long-pressing anywhere on the terminal and selecting the Help menu option to learn more.

Want to ask questions, report bugs or give feedback?
See https://termux.com/community

Сообщение отредактировал iMiKED — 13.06.20, 08:50

Примечательно, что хотя некоторые плагины платные, на странице автора есть ссылки на исходный код на github-e https://github.com/termux, т.е. можно самому собрать как само приложение так и все плагины; термукс из маркета надо будет удалить и собрать и установить руками потому что подписи должны совпадать.

Если кому-то лень самому собирать, в прицепе моя сборка с плагинами. Отдельно плагины из этой сборки не будут работать с версией из маркета, так как я все подписал своим серификатом, который ессно не совпадает с сертификатом автора.

Если кто-то хочет собрать из исходников, то помимо android sdk также потребуется ndk.

Хотя исходники платных плагинов открыты, я один плагин купил по-любому, потому что очень уж хочется поддержать разработчика за такой мега-подарок.

*ВАЖНО*: Только для андроид версии 5.х и выше!

termux+github+plugins.zip ( 1,48 МБ )

Сообщение отредактировал ccpizz — 13.05.16, 08:26

Сообщение отредактировал LVware — 29.07.16, 18:50

Termux v0.46:
• Work better with the stock CyanogenMod and AOSP keyboards.
• Remove the shaking of the terminal on a bell character introduced in v0.44.
• Restore the ability to press Enter on the on-screen Android TV keyboard.
termux-app_v0.46.apk ( 176,21 КБ )

Termux:API v0.12:
• For use with termux-api version 0.21 or later. Run apt update && apt upgrade to ensure that the latest packages are installed.
• Run any command with a -h flag to learn more.
• Support the new termux-notification-remove command to remove a notification.
• Add several options to termux-notification.
• Add new commands for wifi information: termux-wifi-connectioninfo and termux-wifi-scaninfo.
termux-api_v0.12.apk ( 68,38 КБ )

Termux:Styling v0.16:
• Add monochrome White on Black and Black on White color schemes.
termux-styling_v0.16.apk ( 1,72 МБ )

Termux:Widget v0.7:
• Update app icon.
termux-widget_v0.7.apk ( 54,1 КБ )

Termux:Task v0.1:
• Initial release for testing and feedback.
termux-task_v0.1.apk ( 942,95 КБ )

Termux:Boot v0.1:
• Initial release for testing and feedback.
termux-boot_v0.1.apk ( 26,4 КБ )

Termux:Float v0.7 (Original)

termux-float.apk ( 82,96 КБ )

Сообщение отредактировал rezvorck — 20.01.17, 18:07

Оцените статью
Fobosworld.ru
Добавить комментарий

Adblock
detector
5 . «root

у не хватает прав :-/»

Сообщение от Mosson on 01-Мрт-06, 11:45