web-dev-qa-db-ja.com

非rootユーザーでの「/etc/init.d/networking restart」

私は112mbのシンクライアントを持っていますRAMこれは、ubuntuサーバー12.04.1をopenbox付きのUSBドライブから起動し、学生がCisco機器と通信するために使用されます。唯一のユーザー-Ciscoを使用して、ネットワークインターフェイスを再構成し、再起動せずに再起動できる必要があります。

これは私がこれまでに持っているものです:

adduser Cisco
usermod -a -G dialout Cisco
chown root:Cisco /etc/network/interfaces
chmod 664 /etc/network/interfaces
chmod u+s /sbin/shutdown
chmod u+s /sbin/reboot
chmod u+s /sbin/poweroff
chmod u+s /run/network/if*
chmod u+s /sbin/ifdown
chmod u+s /sbin/ifup

そして、Ciscoとして/etc/init.d/networking restartを実行すると、次のようになります。

*Reconfiguring network interfaces...
rm: cannot remove `eth0.dhclient': Permission denied
Failed to send flush request: Operation not permitted
RTNETLINK answers: Operation not permitted

これを機能させる方法に関するアイデアはありますか?

ありがとう!

1
bonchen

シスコユーザーに適切なSudo権限を追加する必要があります。 /etc/sudoers.d/に、Ciscoという名前のrootとして、次の1行の内容で1つのファイルを作成します。

Cisco ALL=NOPASSWD: /etc/init.d/networking

また、アクセス権を読み取り専用に変更します。

Sudo chmod 440 /etc/sudoers.d/Cisco

もっとUbuntuの方法はSudo service networking restartロジックを使用することですが、これをsudoersファイルに追加する方法がわかりません。

1
Doka