[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Domanda sui permessi per eseguire i comandi



On Monday 30 July 2007, Luca Bedogni wrote:
> On Monday 30 July 2007, automatic_jack wrote:
> > On Mon, 30 Jul 2007 19:39:31 +0200
> >
> > "Simone Tessaro" <simotessa@gmail.com> wrote:
> > > Scusate la domanda sciocca. Ma l'utilizzo di ubuntu mi ha reso tutto
> > > troppo facile e ora voglio prendere coscienza di come è strutturato
> > > debian.
> > > Di base in debian il comando ifconfig non è attivo per l'user ma
> > > funziona solo da root. ora /sbin/ifconfig hai permessi così impostati
> > > drwxr-xr-x . quindi l'esecuzione è per proprietario (root) gruppo
> > > (root) e altri. come mai non è eseguibile allora da un utente normale
> > > (così come tutti i comandi presenti in /sbin in realtà)? I comandi
> > > presenti in /bin come /bin/chmod hanno gli stessi privilegi e infatti
> > > sono eseguibili senza essere super user.
> > > Qualcuno potrebbe farmi chiarezza su questa cosa? cosa impedisce a
> > > quei comandi di essere eseguiti?
> > > Grazie
> >
> > Per le spiegazioni tecniche passo ma...puoi, in genere, applicare due
> > semplici regole: i comandi non utilizzabili dai normali utenti (aka
> > quelli che solo root puo' eseguire) sono in genere relativi al
> > controllo/gestione dell' hardware e/o quelli il cui uso proprio e non
> > pu' cambiare radicalmente la macchina
>
> Ifconfig lo puoi benissimo eseguire da utente.
> bedo@harry:~$ /sbin/ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:01:29:D1:84:67
>           inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
>           inet6 addr: fe80::201:29ff:fed1:8467/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:2131533 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1915924 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:1506978132 (1.4 GiB)  TX bytes:1365598966 (1.2 GiB)
>           Interrupt:21 Base address:0xe000
>
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           inet6 addr: ::1/128 Scope:Host
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>           RX packets:15191 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:15191 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:1446000 (1.3 MiB)  TX bytes:1446000 (1.3 MiB)
>
> bedo@harry:~$
>
> Cio che non puoi fare e' usarlo passando delle opzioni che richiedono i
> permessi da super user.
> bedo@harry:~$ /sbin/ifconfig eth0 192.168.1.2
> SIOCSIFADDR: Permission denied
> SIOCSIFFLAGS: Permission denied
> bedo@harry:~$
>
> Poiche per poter usare quelle opzioni il semplice user non e' sufficiente,
> poiche si usano comandi che cambiano la configurazione del sistema.

Aggiungo una cosa che mi pare di capire dalla tua mail.
ifconfig non lo puoi eseguire "direttamente" poiche non e' presente nel tuo 
PATH.
bedo@harry:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
bedo@harry:~$ ifconfig
bash: ifconfig: command not found
bedo@harry:~$ export PATH=$PATH:/sbin
bedo@harry:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:29:D1:84:67  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::201:29ff:fed1:8467/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2170463 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1950999 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1535034684 (1.4 GiB)  TX bytes:1380766794 (1.2 GiB)
          Interrupt:21 Base address:0xe000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:15418 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15418 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1466047 (1.3 MiB)  TX bytes:1466047 (1.3 MiB)

bedo@harry:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/sbin
bedo@harry:~
Il PATH e' dove la shell va a cercare appunto i comandi. Prima nel mio PATH 
non avevo /sbin, infatti dando solo ifconfig non riuscivo a eseguirlo.
Se invece lo aggiungo, vedi che si esegue tranquillamente.

> > > Simone
>
> Ciao
> 	Bedo

Ciao
	Bedo
-- 
Debian Powered GNU/Linux User #373118
Bedogni Luca - 	Blog | http://blog.lucabedogni.it
		        Site | http://www.lucabedogni.it
Debianizzati - www.debianizzati.org | Founder Member
--
2 + 2 = 5 for extremely large values of 2. 



Reply to: