Полномочия файла Sudoers

Вы изучили distcc? В зависимости от какого "создания" Вы делаете (Вы не указывали), это может быть хорошее соответствие.

0
задан 24 October 2012 в 17:01
4 ответа

The sudoers line can only point to the command you're intended to run, not the destination output file. Anything under that /sys is a special device that characters are written to.

What you want to do is create a script that will do echo 1 > /sys/block/$hd/device/delete where $hd is checked to match the regular expression /sd[b-i]/. Point the sudo command at that script rather than where you have it.

Also, Michael Hampton is right: somebody will run a delete command you don't want mess things up. If you don't have proper backups, then your data never existed.

4
ответ дан 4 December 2019 в 11:55

Поместите свой код в скрипт (вы пишете скрипт, верно?) И предоставьте пользователю sudo доступ к скрипту.

Это, вероятно, закончится выглядит примерно так:

#!/bin/bash
for kill_this_disk in /sys/block/sd[b-i]/device/delete
do
    echo 1 > $kill_this_disk
done

И я надеюсь, что у вас хорошие резервные копии.

1
ответ дан 4 December 2019 в 11:55

I don't think **operator ALL=/sys/block/sdb/device/delete ** will enable you to access that device even as non root. The sudoers enables you to specify commands which will not query for the password when ran as sudo (here "tee" for example). Your problem comes from permissions on the /sys/block/$hd/device/delete...

0
ответ дан 4 December 2019 в 11:55

Perhaps you need to use the NOPASSWD option in the sudoers configuration file. I believe the syntax is something like this:

operator ALL=NOPASSWD:/sys/block/sdb/device/delete
-1
ответ дан 4 December 2019 в 11:55

Теги

Похожие вопросы