Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
suid и скрипт
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Russian
View previous topic :: View next topic  
Author Message
Semyon
n00b
n00b


Joined: 27 Mar 2005
Posts: 14

PostPosted: Sat Mar 21, 2009 7:27 pm    Post subject: suid и скрипт Reply with quote

Здравствуйте!

Имеется некоторый скрипт, который настраивает сеть (т.е. использует ifconfig, iwconfig).
Как мне сделать так, чтобы обычный пользователь смог его выполнить?
chmod u+s script.sh не помогает (наверное, я не совсем понимаю, что делает suid).
Back to top
View user's profile Send private message
axce1
n00b
n00b


Joined: 13 Mar 2009
Posts: 12

PostPosted: Sun Mar 22, 2009 7:46 am    Post subject: Reply with quote

как вариант можно сделать так

chmod 4755 script.sh

и если память не изменяет мне то suid ставиться chmod +s script.sh
Back to top
View user's profile Send private message
Semyon
n00b
n00b


Joined: 27 Mar 2005
Posts: 14

PostPosted: Sun Mar 22, 2009 12:53 pm    Post subject: Reply with quote

axce1 wrote:
как вариант можно сделать так

chmod 4755 script.sh

и если память не изменяет мне то suid ставиться chmod +s script.sh


chmod +s script.sh cтавит suid и sgid одновременно (т.е. равносильно chmod u+s script.sh; chmod g+s script.sh)
Вот пример который не работает:

script.sh:
Code:

#!/bin/bash

/sbin/ifconfig eth0 192.168.2.3


если

Code:
$ chmod 4755 script.sh


то

Code:
$ ./script.sh
SIOCSIFADDR: Отказано в доступе
SIOCSIFFLAGS: Отказано в доступе
Back to top
View user's profile Send private message
mango123
Apprentice
Apprentice


Joined: 07 Dec 2004
Posts: 266
Location: msk

PostPosted: Sun Mar 22, 2009 1:27 pm    Post subject: Reply with quote

а sudo -никак нельзя дать?
типа
Code:
%users  ALL=/sbin/твой_скрипт NOPASSWD: ALL
Back to top
View user's profile Send private message
Semyon
n00b
n00b


Joined: 27 Mar 2005
Posts: 14

PostPosted: Sun Mar 22, 2009 4:58 pm    Post subject: Reply with quote

mango123 wrote:
а sudo -никак нельзя дать?
типа
Code:
%users  ALL=/sbin/твой_скрипт NOPASSWD: ALL


Да, sudo подходит - я не знал что его можно так использовать.
Только строка несколько другая по-моему
Code:
%users ALL= (root) NOPASSWD: /sbin/myscript
Back to top
View user's profile Send private message
mango123
Apprentice
Apprentice


Joined: 07 Dec 2004
Posts: 266
Location: msk

PostPosted: Mon Mar 23, 2009 7:14 pm    Post subject: Reply with quote

Semyon wrote:
mango123 wrote:
а sudo -никак нельзя дать?
типа
Code:
%users  ALL=/sbin/твой_скрипт NOPASSWD: ALL


Да, sudo подходит - я не знал что его можно так использовать.
Только строка несколько другая по-моему
Code:
%users ALL= (root) NOPASSWD: /sbin/myscript



Блин, ошибся. Писал по памяти :D
Back to top
View user's profile Send private message
andrey-x
n00b
n00b


Joined: 09 Jul 2002
Posts: 32
Location: Russia

PostPosted: Tue May 26, 2009 6:11 pm    Post subject: Re: suid и скрипт Reply with quote

Semyon wrote:

chmod u+s script.sh не помогает (наверное, я не совсем понимаю, что делает suid).

Флаг suid на сценарии командной оболочки установить конечно можно, только он игнорируется самой командной оболочкой! Т.е. устанавливать флаг suid на сценарии бессмысленно.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum